I am wondering if anyone can give me some advice on what to check/look at to solve the following problem.
I had an image uploader which once worked… then my site became unusable because a trial period expired.
Then I paid up and got my site back (but my host company are complete tools and haven’t done it properly… so I eventually got it sorted myself by altering the permissions on the .htaccess file)
but now that I’ve got the site ‘back’ I still have a few problems with certain parts.
I have an image uploader which now produces the following error…
"Uploading file 1191543704997.jpg…
Warning: move_uploaded_file(1191543704997.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/<r>/public_html/photos/upload_multiple.php on line 60
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/phprtJ89G’ to ‘1191543704997.jpg’ in /home/<r>/public_html/photos/upload_multiple.php on line 60
There was an error uploading the file!"
I have played about with the permissions on the tmp folder, to no avail.
eta: ‘<r>’ is meaninglesss… I just replaced my site username with that for security purposes.
I don’t know php but could it be a server problem, not a php or OS file permissions issue? Some servers restrict where files may be placed as a security measure.
I’ts a simple answer too. I can’t believe I didn’t try it. I was assuming there was something wrong with the source folder. It never occured to me there might be something wrong with the permissions onthe destination folder.
From the error msg and small snippet of code, it looks like the upload script uploads to /tmp/phprtJ89G and then moves the file ‘elsewhere’. It looks like you don’t have permission to the ‘elsewhere’. If basename($_FILES[‘file’.$i][‘name’]) resolves to just ‘1191543704997.jpg’ then it’s attempting to move it to where the script is executing from, /home/<r>/public_html/photos/. You’ll need to give the user running the webserver (if it’s a generic apache install, for example, the user is ‘apache’) permission to write to that folder.
Edit: looks like I was beat to the punch. Be warned though, 777 is essentially giving anybody and everybody full permission to that folder. You might want to tailor it back a bit.