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
https://forums.phpfreaks.com/topic/18024-permission-problems-with-mkdir/
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?
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...

Archived

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

×
×
  • 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.