Hello List,

this is probably a very stupid question, but I dont know how to solve this
little problem:
I have a script with which text files (exported access db data sheets) can
be uploaded to the mysql tables.
It all works fine, but very annoyingly I get warning messages, if the text
file is not resident on the server. But I want it in a way that it doesnt have
to be on the server...a catch. The php manual says that if the file
cannot be opened fopen returns false. All nice and good working, but I get
those additional warning messages. Im not sure if it has maybe something
to do with the server, but I am not convinced. Ill put the code below.
Any suggestions are highly appreciated (I tried die command but it somehow
messed up the routine).


$file = array ("colours.txt", "categories.txt", "stockmain.txt", 
$i = 0;
while ($file[$i])
//öffne das textfile
         $datei = "";

         if ($datei = fopen($file[$i], "r+"))
                 $zaehler = 0;
//check wieviele zeilen das textfile hat
//um zu verhindern, dass es leer ist!
                 while (!feof ($datei)) //liest jede zeile einzeln mit fget()
                         $buffer = fgets($datei, 1000);
                         //echo $buffer;
                         //echo "<br>";
                 } //end while (!feof ($datei))

                 // MORE CODE AFTER THIS....
                 // .....

                         <td>The file <? echo $file[$i]; ?> could not be 
opened: no Mysql insert.</td>
         if ($datei)
         { fclose($datei); }


Warning messages are:

Warning: fopen("categories.txt","r+") - No such file or directory in *some 
directory* on line 32

I hope anybody can help...

- Nessi -

Reply via email to