Click to See Complete Forum and Search --> : upload permission problems


matstuff
12-30-2004, 06:17 PM
Hey there,

I'm trying to write a simple bit of code to upload a file. The annoying thing is that this code was working a week or two ago when I first wrote it, and now it's not. The problem comes when I try to move the uploaded file from the tmp directory to its final destination and I get the old "...failed to open stream: Permission denied in..." The folder permissions are 0755, and can't be chmod'd ("Operation not permitted in..."). Also, I'm not sure how to SSH to this server, so can't get to the folder that way - anyway, I'm not sure I want to set the permissions to 0777.

Is it possible to make my page log into the server so that it's not just an anonymous user running the script?

Even if I log in to the cpanel of the site from this computer, I still get the permissions error - I wondered if that might have been the difference between last time and this time; obviously not.

Any suggestions?!

Big thanks in advance,

Mat

[Edit: ALSO, there appears to be two folders with my php in it - .../www/ and .../public_html/ $_SERVER['document_root'] indicates that the file is running in public_html, but I'm pretty sure I upload to www - are the two folders just mirrors of each other or what?!?!]

ShrineDesigns
12-30-2004, 11:43 PM
you will need to chmod the directory to 0777

matstuff
12-31-2004, 05:33 AM
The directory won't allow this. I get an error when I try. And anyway, aren't there security issues with setting it to 0777?

AdamGundry
12-31-2004, 07:28 AM
Yes, setting the directory to 0777 would mean it was writeable to all users on your server, which could potentially be a problem. It sounds like the directory is owned by a different user to the user running the PHP script (which will probably be the web server user, such as apache), since otherwise 0755 would be ok.

I don't know what's going on with the folders - perhaps one of them is a link to the other?

Adam