...

View Full Version : Dynamic Folder permission problems



ascend
08-17-2005, 12:56 AM
I'm setting up a light CMS for a client that creates new folders/directories when she adds a subsection to her site. On a seperate page, she can add images that are placed inside of these directories and I'm able to do that with existing directories, but not the ones created dynamically. I'm using the following code to create the directory:



mkdir("../portfolios/$subname", 0777)


Which creates the folder successfully, but the permissions are off when I check them out and I'm unable to copy files to it. Is this a server setting? Or has anyone run into anything like this? Thanks for any help...

delinear
08-17-2005, 10:04 AM
There are a couple of things you could try. Firstly it could be the umask of the server throwing things off. Try doing this:

$original_umask = umask(0);
mkdir("../portfolios/$subname", 0777);
umask($original_umask);
If that doesn't work, you might consider using PHP's ftp functions to actually create the directory as if you were a normal ftp user, or to chmod the directory just like an ftp user - that should solve the permission problems but the first resolution is preferable since it's much simpler.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum