Page 1 of 1

Folder permissions and PHP

Posted: Tue Jul 10, 2007 1:43 pm
by bos45430
When my users create an account, my code creates personal folders for them.

$currentdir=getcwd();
$savedir="$currentdir/users/$_COOKIE[username]/albums/$_POST[albumname]";
mkdir($savedir,0777);

BUT it isnt creating the folders with a 777 permission. Its a Linux server running Apache. How can I make my script create the folders with 777 chmod by default?

Any help greatly appreciated

john

Posted: Tue Jul 10, 2007 1:59 pm
by dirkr
not sure but you can always try taking a look at the chmod function ( not sure if that works on folder too )

Posted: Tue Jul 10, 2007 2:16 pm
by Ollie Saunders
if $currentdir = 'foo' the value of $savedir after the assignment is:

Code: Select all

foo/users/Array[username]/albums/Array[albumname]
Read the PHP manual on strings, in particular variable substitution in double quoted strings.