Programatically create directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

 

I am hoping someone can point me in the right direction here. This may be
more of an Apache than PHP issue, but in the hopes someone here might have
had some experience with this ..

 

I am developing functionality which will allow our users to upload photos so
that we can share comments on the photos between ourselves and the user.

 

The issue I am having is that when someone creates an account for this, I am
programmatically creating a folder specific to that user in an temporary
/temp/ and permanent upload /upload/ directory (i.e. 2 folders). Although I
am chmod the folder at the time it is created, it seems the user cannot
upload to the folder.

 

The only way I am able to get it to work is if I create the folder manually
via FTP. My research indicates it might have something to do with the Apache
UID or GUID, but being a relative novice with Apache I am at  a loss. I've
tried multiple directives via a per directory htaccess file and nothing
seems to work. 

 

I can, of course, create a number of anticipated folders (based on a project
id) manually to get around this, but prefer not to do that. 

I could also dump everything into just temp without having it in a project
id folder but I would like to separate content in case of simultaneous
users. 

 

Additionally, the file upload only seems to work if the folder is 0777,
which I know can have security implications. Advice? I am using plupload. 

 

Here is a portion my code: 

 

//temp dir

                $dir = $_SERVER['DOCUMENT_ROOT'].'/projects/temp/'.$pid.'/';

                mkdir($dir);

                //echo $dir."<br />";

                

                if (is_dir($dir) ) { 

                chmod($dir, 0777);

                }

 

Any suggestions for me, please? Thanks.

 

Jen Rasmussen 

Web Development Manager | Cetacea Sound Corp.

763-225-8465 | www.cetaceasound.com


P Before printing this message, make sure that it's necessary. The
environment is in your hands

 


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux