Jump to content

Archived

This topic is now archived and is closed to further replies.

Yesideez

Permission problems with mkdir()

Recommended Posts

I've created a folder using FTP and this:
[code]mkdir("profiles",666);[/code]

Both times the folder is created no problem. I need my script to create extra folders inside "profiles" on the fly as users register yet when I try this:
[code]mkdir("profiles/oliveri",666);[/code]

I get this error message:
[code]Warning: mkdir(profiles/oliveri): Permission denied in /home/randgigs/public_html/profile.php on line 8[/code]

The value 666 in mkdir() is for read & write access.

Can someone tell me where I'm going wrong please?

Many thanks.

Share this post


Link to post
Share on other sites
I seem to have a case of "post a question then find the answer yourself"... :S

Change 666 to 0666 for octal and it works.

Only problem is, any picture I upload into profiles/oliveri/ gives me a 403 (Forbidden) when I try and display them.

Any idea of what permissions I have to set the "oliveri" folder to allow anyone access to it without letting the general public delete files contained within these folders?

Share this post


Link to post
Share on other sites
Thanks, just been reading up on it and discovered that if a folder is set to "execute" it doesn't mean files in that folder can be executed (as I thought) but means that the folder can be searched/browsed.

Now just got to add a small index.html file in each folder to stop people browsing them...

Share this post


Link to post
Share on other sites
good style also is put just one .htaccess with "deny from all" directive at the top of this tree of folders - and they never will be shown to user.

Share this post


Link to post
Share on other sites

×

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.