English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How do I do this, could you give an example please of say how to make a folder called "Animals".
Thanks

2007-12-01 13:01:32 · 2 answers · asked by peter s 1 in Computers & Internet Programming & Design

2 answers

http://www.php.net/manual/en/function.mkdir.php

2007-12-01 13:04:55 · answer #1 · answered by mdigitale 7 · 0 0

the PHP function to make a directory is mkdir.
In you case you would have:

if(!is_dir("Animals")){ mkdir("Animals"); }

Always verify that the folder does not already exists.
The above PHP statement presumes that the "Animals" folder will be a subfolder in the folder containing your current PHP file. Otherwise you will need to define a relative path i.e.

if(!is_dir("../Myfolder/Animals")){ mkdir("../Myfolder//Animals"); }

In this case "Animals" will be a subfolder of "Myfolder" which is one level above the folder where your PHP scripts is called from.

2007-12-01 13:25:39 · answer #2 · answered by Capacitor 2 · 0 0

fedest.com, questions and answers