Hi,
as far as i can follow you, you want to:
  1. copy a file from position a to position b.
  2. read it from position b.
  3. and delete it at position b.

Why not read it directly from position a?
So what about:
  $content = implode("<br>", file($userfile));

Anyway: You should initialize $i in any way, best with zero -> $i=0; before 
the while loop.
You check if 0.tab 1.tab 2.tab; if 2.tab exists, you create 3tab (A dot seems 
to be missing) $destfile .= '.tab'; instead of $destfile .= "tab";

Is this script executed on unix? That would clearify why it could not find 
C:\\My Documents\\lyrics\\C_DTBS\\SLIME.TXT :-)

--Sascha

Am Sonntag, 13. Oktober 2002 12:15 schrieb [EMAIL PROTECTED]:
> I posted "User Upload" and with no advice I attempted to use the sources i
> could find and came up with the following:
>
> while (file_exists("$i.tab")) {
> $i ++;
> }
> $destfile = $i;
> $destfile .= "tab";
> stripslashes($userfile);
> copy($userfile, "/uploads/" . $destfile);
> chdir("/uploads");
> $lines = file($destfile);
> $content = implode("<br>", $lines);
> unlink($destfile);
> echo("$userfile_name");
>
> It doesnt work (surprise, surprise), what im trying to do is upload the
> file to my /uploads/ directory then read it and store it on the $content
> variable, then the content variable inserts a row into db (allready done),
> then I delete the file the while loop is to make sure I dont overwrite the
> file and make an error in my database.
>
> The errors PHP returns are:
>
> Warning: Unable to open 'C:\\My Documents\\lyrics\\C_DTBS\\SLIME.TXT' for
> reading: No such file or directory in /home/tabzilla/public_html/doadd.php
> on line 89
>
> Warning: ChDir: No such file or directory (errno 2) in
> /home/tabzilla/public_html/doadd.php on line 90
>
> Warning: file("tab") - No such file or directory in
> /home/tabzilla/public_html/doadd.php on line 91
>
> Warning: Bad arguments to implode() in /home/tabzilla/public_html/doadd.php
> on line 92
>
> Warning: unlink() failed (No such file or directory) in
> /home/tabzilla/public_html/doadd.php on line 93
>
>
> ANY HELP? ANYONE???


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to