I'm new to PHP. I planned to create folder, sub folder, into that file depends on user Input.
Folder and sub folders has been created successfully.
Finally I try to create a file its showing bellow error.
fopen(upload/localhost/hrms): failed to open stream: Permission denied in C:\xampp\htdocs\ssspider\index.php on line 205
My code is:
$dir = "http://localhost:8080/hrms/index.php";
//make directory
$directoryForServer = "upload";
$directoryForClient = $directoryForServer."/".$host."";
mkdir($directoryForClient);
$splitePath = explode("/", $folderPath);
$folderPath1 = $directoryForClient;
for($x = 1; $x <= (count($splitePath)-1) ; $x++)
{
    $folderPath1 = $folderPath1."/".$splitePath[$x];
    echo "<br>".$folderPath1." - successfully created<br>";
    mkdir($folderPath1);
}
writefile($folderPath1);
function writefile($dir)
{
 if( is_dir($dir)){
    echo $dir;
    $myFile = fopen($dir,"w");
    if($myFile)
    {
        fwrite($myFile, $returned_content);
    }
    fclose($myFile);
  }
}
Please help me to find out my problem?
Edit: Thanks. I got an error. In fopen I didn't mention file name . Now its working fine. Thanks
 
     
    