It might be a good idea to make sure that the directory you are processing is indeed a directory. This code works ... edit as you like.
define("PATH", "/home/born05/htdocs/swish_s/Swish"); $test = "set"; $_POST["dirname"] = "test"; if (isset($test)) { //get value of inputfield $dir = $_POST['dirname']; //set the target path ?? $targetfilename = PATH . '/' . $dir; if (!is_file($dir) && !is_dir($dir)) { mkdir($dir); //create the directory chmod($targetfilename, 0777); //make it writable } else { echo "{$dir} exists and is a valid dir"; }
Good luck
Edited: comment was good advice;)
source share