...

View Full Version : new folder permissions



maroccano1
05-03-2009, 02:58 PM
i have recently uploaded my site onto a webserver, the site requires users to upload mp3 tracks and then streams the tracks using flash. When a user registers a new folder is created to the server to store the mp3s and assigned the same name as the user. The problem is that the folder does not have the correct permissons and so the flash app cannot read the folder. If i manually alter the folders permissons to allow all, it works. is there a way to do this with php? At the moment i am using:

mkdir($d, 0777);

thanks

Killermud
05-03-2009, 03:07 PM
Try using this :


$oldumask = umask(0);
mkdir($d, 0766);
umask($oldumask);

maroccano1
05-03-2009, 03:22 PM
that didn't seem to work but when i tried:

$oldumask = umask(0);
mkdir($d, 0777);
umask($oldumask);

it Worked! i don't why but it did. What does the mask do?

Killermud
05-03-2009, 03:31 PM
Oh right its because I had the permissions as 766 not 777.

the umask function sets PHP's umask to mask & 0777 and returns the old umask.

maroccano1
05-03-2009, 03:40 PM
cool, thanks alot.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum