Page 1 of 1

Folder Permission and PHP image Upload

Posted: Wed Sep 16, 2009 11:50 pm
by daggs81
Hello,
I know how to make a php script to upload an image, store the info in a db and all, but you have to manually go and change the permission of the directory that you want to upload your images to.

Is there a way to use a script to change that folders directory permissions with an install file or something?

I am building a fully customizable website with php for someone and want them to just upload the folder (entire site) i give them, and then be able to start adding all their info and be able to upload images with out having to worry about whether or not the upload folder has the right permissions to be able to upload to.

Can some one please help me with this? Thank you in advance.

Re: Folder Permission and PHP image Upload

Posted: Wed Sep 16, 2009 11:58 pm
by dude81
You can use chmod and its related function,if the code is being deployed on Linux box

Re: Folder Permission and PHP image Upload

Posted: Thu Sep 17, 2009 12:50 am
by daggs81
so what if the users webserver is on a windows box? how does wordpress do it?

thank you by the way, this will be very helpfull

Re: Folder Permission and PHP image Upload

Posted: Thu Sep 17, 2009 1:16 am
by dude81
Not sure, But Imo, if the php gets the permission to get executed on the web server, it would let the php to do files upload with write permission.

Re: Folder Permission and PHP image Upload

Posted: Thu Sep 17, 2009 11:10 am
by daggs81
So im guessing that this might work? http://us2.php.net/function.mkdir

Apparently if the directory is created with php then you can make the permissions what ever you want. Im going to give it a try and see what i come up with.