Page 1 of 1

File upload permission errors

Posted: Mon Oct 22, 2007 5:19 pm
by ranger3
I get two warnings when attempting to upload a file to the images directory in the DocumentRoot for a virtual host in Apache2:
Warning: move_uploaded_file(/home/vsftpd/nameofsite/www/images/icon1.gif) [function.move-uploaded-file]: Failed to open stream: Permission denied...
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php6oPKJ2' to '/home/vsftpd/nameofsite/www/images/icon1.gif'...Error: could not move file to destination directory
The DocumentRoot is set to /home/vsftpd/nameofsite/www.

I have searched for information on the permission errors and how to avoid them but keep going round in circles. Any help on this much appreciated.

Posted: Mon Oct 22, 2007 5:35 pm
by VladSun
Try

Code: Select all

chmod 0777 /home/vsftpd/nameofsite/www/images

Posted: Mon Oct 22, 2007 5:54 pm
by ranger3
Thank you for the reply - your suggestion worked! Much appreciated.

My only concern now is the security implications of chmod 0777. Does this mean that anyone can upload anything to the images directory, or is the upload restricted to only those users who have access to the php upload script (ie by logging into the website as administrator)? Bit hazy on this...

Posted: Mon Oct 22, 2007 6:30 pm
by feyd
If memory serves 644 or 655 works fine for uploads.