Creating a directory

Creating a directory

bool mkdir ( string pathname [, int mode [, bool recursive [, resource context]]] )

the function mkdir is used to create a directory in the system.

a simple step to create a directory.

<?php

mkdir(”/path/user/dir_new”);
?>

The above script will create a directory “dir_new” under the existing directory “user”.

File permission for directory

we can give the permission to the directory by specifying it in the mode field.

<?php

mkdir(”/path/user/dir_new”,0777);
?>

the permission 0777 is octal specification , which is the best method
to specify the permission then as decimal 777.

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.