I keep getting this error on a new server I just setup
[Wed Feb 16 22:46:51 2011] [error] [client 71.1.236.114] PHP Warning:
move_uploaded_file(upload/110216104651_00134_smooth_1440x900.jpg):
failed to open stream: Permission denied in /var/www/admin/_application/models/Roles.model on line 1757,
referer: http://nacc.biz/admin/admin/modifyarticle.php?roleid=4
[Wed Feb 16 22:46:51 2011] [error] [client 71.1.236.114] PHP Warning: move_uploaded_file():
Unable to move '/tmp/php6wlOg1' to 'upload/110216104651_00134_smooth_1440x900.jpg'
in /var/www/admin/_application/models/Roles.model on line 1757, referer:
http://nacc.biz/admin/admin/modifyarticle.php?roleid=4
[Wed Feb 16 22:46:51 2011] [error] [client 71.1.236.114] PHP Notice:
Upload Error: Error moving from temp dir in /var/www/admin/_application/models/Roles.model on line 1759,
referer: http://nacc.biz/admin/admin/modifyarticle.php?roleid=4
I added 777 and created a uploads dir, but the error persists. How do I find the path that needs to either be corrected or created?
Provided, there are no spelling mismatches, give your upload directory (that directory ONLY) all user rights
sudo chmod a+rwx /path/to/folder
, that should fix the problem easily.For a quick further read about permissions in Ubuntu, check here.
Change owner of
upload/
towww-data:www-data
and also chmod to755
It's trying to move the file to
upload/
notuploads/
, make sure the directory exists and is writable.Log into your ftp and confirm the following:
0666
looking at the log:
It seems to me that its looking in your root directory as
upload/110216....
should bepath.to/public_html/upload/110216....
If none of the above work, please post your line of code that has
move_uploaded_file
on.Looks like it doesn't know where
upload/
is. Make sure you have the full path in your statement. For example, if upload directory is actually located in/var/upload
, then make sure that is in your statement, not justupload
/.