This is the same sort of error I'm getting.  Try printing out the variables

$userfile
$userfile_name
$userfile_size
$userfile_type

Telnet or ssh into your system and see if the file is getting transferred into
the directory identified in $userfile.  In my case, the upload file isn't
getting saved in the /var/tmp directory, so the copy statement has nothing to
copy from.  Unfortunately, the error message appears to point to the output
file, when the error is on the input side of the equation.

Let me know what you find.

-David Schwartz


Mike Yuen wrote:

> I am trying to allow various users to upload their own picture.  What I
> would like to happen is to have the copy statement rename the .jpg
> image to the username.  For example, if the username is mike, then I want
> the picture to be renamed mike.jpg
>
> The following is a snippet of code:
>
> <?PHP
> print "$CUserName" //ensures name is carried over from session
>
> if(copy($userfile,"c:/phpweb/userpics/$CUserName.jpg"))
>         {
>         print "Your picture has been uploaded!";
>         }
> else
>         {
>         print "Error";
>         }
>
> unlink($userfile)
> ?>
>
> The errors I get are as follows:
> Warning: unable to open " for reading: Permission denied in
> c:\phpweb/fuploadconfirm.php on line 15
> Warning: Unlink failed (No such file or directory) in
> c:\phpweb/fuploadconfirm.php on line 31
>
> Line 15 is the if copy($userfile........) line in the above code
>
> AND
>
> Line 31 is the unlink statement at the end.
>
> Thanks,
> Mike
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to