Jump to content

error when changing folder permission using chmod()


svgmx5

Recommended Posts

I'm having a problem uploading files with using move_uploaded_file() function. I'm pretty sure i know that is related the folder permissions, however i've tried using chmod() to change the permissions of the folder so i can upload it but i get the following error:

 

Warning: chmod() [function.chmod]: Permission denied in D:\Hosting\8163784\html\demo\dashboard\myadd\place_bid.php on line 250

 

and this is the script that i'm using:

 


chmod("../files/cp_ads/", 0777);

 

The path "files/cp_ads/" is one level up from the file that the script above is at.

 

Basically i want to change it to 0777 so it can uplaod the file and then i change the permissions again to the default. I've tried changing the permissions by going through the ftp server to 777 and i can upload the file with no problems..but when i set it to 0664 and i try to change the permission using the script above it won't let me ..

 

any ideas?

Link to comment
Share on other sites

in that case, how can i allow people to upload files to the server with out changing the permissions through the ftp? basically users are allowed to upload files to the server and the only way i see so far is to permanently change the permissions to 777 on the server, which i don't feel comfortable doing since it will be open to anyone and i just want to open it to the users who are signed up.

 

I just want to be able to open the folder, upload the file and then close it

 

Also if it helps..the server is a shared server with godaddy and its a windows server

Link to comment
Share on other sites

Since you don't have control over the webserver/PHP setup, all the solutions have flaws.

 

IMO the best you can do is let PHP create that folder and leave it as the default 0755. Every instance of PHP could modify the contents of the directory, but somebody would have to use PHP to access the contents rather than do so directly.

1. chmod 0777 files/

2. Make a quick PHP script to create files/cp_ads

3. chmod 0755 files/ back

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.