NYCPHP Meetup

Setting directory permissions

jsiegel1 at optonline.net jsiegel1 at optonline.net
Fri Apr 18 18:05:02 EDT 2003


I'm sure this is an easy one but...since I'm still learning PHP...I'm scratching my poor bald head. ;)

Here's a code snippet:

//create new directory with the id name if it doesn't exist, chmod to 777
if(!is_dir($id)) {
    $root = getenv('DOCUMENT_ROOT');
    $id = $root . '/pic_test/' . $id;
    mkdir($id,0777);
}

The problem is...this only works if I chmod the subdirectory "pic_test" to 777 using my FTP application. However, I want to quickly change the permissions via PHP code, upload some pictures with my form, then change the permissions back to 755.

Thoughts/comments greatly appreciated.

Jeff




More information about the talk mailing list