I have an upload form that seems to be set up correctly. Upon submitting the form, the file is stored in the /tmp directory on the server. I am able to retrieve variables like userfile, userfile_name, userfile_size, etc, but cannot copy or move the file after upload.

I have tried using both copy() and move_uploaded_file(). Using move_uploaded_file, I get two error messages:

1.) Warning: Unable to create '/home/sites/site2/web/images/photos/newimage.jpg': Permission denied in /home/sites/site2/web/adm/admin_photos3.php on line 33

2.) Warning: Unable to move '/tmp/phporr5I2' to '/home/sites/site2/web/images/photos/newimage.jpg' in /home/sites/site2/web/adm/admin_photos3.php on line 33

Using copy() however, I only get 1 error message:

1.) Warning: Unable to create '/home/sites/site2/web/images/photos/newimage.jpg': Permission denied in /home/sites/site2/web/adm/admin_photos3.php on line 33

The server is a Cobalt Raq4 appliance with PHP 4.0.3p|1. Get_current_user() returns my site administrator username. Is there a problem with PHP permissions for filesystem privileges? Any suggestions welcome, thanks in advance!

    Could it be a directory structure permissions issue ???? What OS are you running ????

      I think so now. The upload_tmp_dir in php.ini has no value, so it's defaulting to /tmp. I did some tooling around and figured out /tmp is owned by root, so I figure that's why I can't copy or move. If a new directory is created, say /php_upload_tmp, and ownership is given to nobody, and upload_tmp_dir is set to that directory, should it work?

        Write a Reply...