Trying to upload file to a website<

liunx

Guest
I'm trying to use PHP to upload a file from a local pc to a directory on my domain.

But I get this error ...

Warning: copy(/home/sites/site***/web/hotels/2.jpg): failed to open stream: Permission denied in /home/sites/site***/web/adminhotel.php on line 183


It seems that I don't have permission but I'm not sure how to go about fixing the problem.

Thanks for any help.

SimonYou can try CHMOD'n it to 777 or something.
O, by me saying it, i meant the folder that you plan to upload it to.

That's all the advice I can give you.what is the code you have? does the destination folder exist?Thanks for that ... it was chmod 777 that solved the problem.

is that the only value it can be as full access makes me a bit nervous!well after uploading you can always chmod it back in code.how do chmod in PHP?

how cool ... PHP amazes me sometimes!!chmod ("folder_name", 0755);should it be 0777 to chmod 777?yes if you want to chmod it before you upload.Scoutt, thanks for your reply and your help with this.

I get a permission denied error when I try to chmod the directory. I'm assuming this is because apche is uploading the file and is not allowed to chmod directories.

IS there anyway that I can get round this? What I want to do is to chmod the directory to 444 when it is not being used and then chmod it to 777 in the script to upload the file before chmoding it back to 444.

Is this possible?it should chmod it before you upload. are you sure you are able to upload and have permissions like that?
 
Back
Top