mkdir() says theres no such directory and fails?

后端 未结 7 2032
逝去的感伤
逝去的感伤 2020-12-16 09:07

Im likely doing something very simply wrong, but when I try to make a directory (using a variable of an insert just performed as the last folder name), I get the error:

7条回答
  •  天涯浪人
    2020-12-16 09:51

    • recursive Allows the creation of nested directories specified in the path name.
    • but did not work for me!! for that here is what i came up with!!
    • and it work very perfect!!

    $upPath = "../uploads/RS/2014/BOI/002"; // full path
    $tags = explode('/' ,$upPath); // explode the full path
    $mkDir = "";

    foreach($tags as $folder) {          
        $mkDir = $mkDir . $folder ."/";   // make one directory join one other for the nest directory to make
        echo '"'.$mkDir.'"
    '; // this will show the directory created each time if(!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } }

提交回复
热议问题