Folder Permission and PHP image Upload

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
daggs81
Forum Newbie
Posts: 3
Joined: Wed Sep 16, 2009 11:43 pm

Folder Permission and PHP image Upload

Post 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.
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Re: Folder Permission and PHP image Upload

Post by dude81 »

You can use chmod and its related function,if the code is being deployed on Linux box
daggs81
Forum Newbie
Posts: 3
Joined: Wed Sep 16, 2009 11:43 pm

Re: Folder Permission and PHP image Upload

Post 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
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Re: Folder Permission and PHP image Upload

Post 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.
daggs81
Forum Newbie
Posts: 3
Joined: Wed Sep 16, 2009 11:43 pm

Re: Folder Permission and PHP image Upload

Post 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.
Post Reply