Jump to content

Permission problems with mkdir()


Yesideez

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.
Link to comment
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?
Link to comment
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...
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.