note 22879 added to function.mkdir
| From: | brendan dot gogarty at utas dot edu dot au dot nospam | Date: | Wed, 03 Jul 2002 05:04:45 +0000 |
| Subject: | note 22879 added to function.mkdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-32533@lists.php.net to get a copy of this message | ||
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);
}
}
--
http://www.php.net/manual/en/function.mkdir.php
http://master.php.net/manage/user-notes.php?action=edit+22879
http://master.php.net/manage/user-notes.php?action=delete+22879
http://master.php.net/manage/user-notes.php?action=reject+22879