I want to create a directory in a Linux system. The parent directory which will contain the newly created directory has a 777 permission. The problem is that if the new directory doesn’t include a subdirectory then it is created successfully. But when it contains a subdirectory , for example docs/photos then the subdirectory ( here /photos ) is not created ! So how to make the subdirectory created ?
Here is the codes :
if (!file_exists($rep))
{
if (mkdir($rep))
{
move_uploaded_file($_FILES['upload_field']['tmp_name'] , $rep."/"."photo".$image_id.".png");
}
}
The documentation for mkdir indicates that there is a
$recursiveparameter you should use for this.Read the docs for usage.