note 22879 deleted from function.mkdir by aidan
| From: | aidan@php.net | Date: | Sun, 03 Oct 2004 13:40:03 +0000 |
| Subject: | note 22879 deleted from function.mkdir by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77843@lists.php.net to get a copy of this message | ||
Note Submitter: brendan dot gogarty at utas dot edu dot au dot nospam
----
I am not sure if this is only a Win/Win2k problem.
However when using mkdir on this system to create a folder you can ONLY create a folder under an
existing folder
that is if you have c:\tmp
which is an empty folder
mkdir("c:\tmp\new",0777); WILL WORK
however
mkdir("c:\tmp\new\new2\new3",0777) WILL NOT WORK as the subdirectories new and new2 do not
exist and windows does not make them for you.
use the following in such cases
$the_path="c:\tmp\new\new2\new3";
if(!file_exists($the_path)) {
$a="";
foreach(explode("/",$the_path) AS $k) {
$a.=$k."/";
if(!file_exists($a)) mkdir($a, 0777);
}
}