Jump to content

php mkdir subdirectories


php_begins

Recommended Posts

I have problem creating multiple sub-directories inside a single directory using mkdir:

 

mkdir("files/".$lname,0777);

mkdir("files/".$lname."/CV",0777);

The above command works fine and creates the directory under $last name as files/$lname/CV.

But I am unable to create further sub-directories inside $lname.

For eg:

mkdir("files/".$lname."/Cover", 0777); (This does not create the directory Cover)

 

this is how my code snippet looks like

if($result)

{

    mkdir("files/".$lname,0777);

    mkdir("files/".$lname."/CV",0777);

    mkdir("files/".$lname."/Cover", 0777);

  mkdir("files/".$lname."/LOR", 0777);

}

   

 

Link to comment
https://forums.phpfreaks.com/topic/237244-php-mkdir-subdirectories/
Share on other sites

This is my code:

//Create INSERT query

$qry = "INSERT INTO $tbl_users(email, password, firstname, lastname, middlename, mailingaddress, phone, date, phdinst, researcharea, position) VALUES('$email','$password','$fname','$lname', '$mname', '$address', '$pnumber', '$date', '$inst', '$rarea', '$position')";

 

 

$result = @mysql_query($qry);

if($result) {

error_reporting(E_ALL);

                ini_set('display_errors', '1');

 

        $oldmask = umask(0);

          mkdir("/san/www/files/".$position."/".$lname."_".$email,0777);

  mkdir("san/www/files/".$position."/".$lname."_".$email."/CV", 0777);

  mkdir("san/www/files/".$position."/".$lname."_".$email."/Cover_letter", 0777);

  mkdir("san/www/files/".$position."/".$lname."_".$email."/List_of_references", 0777);

  mkdir("san/www/files/".$position."/".$lname."_".$email."/teaching_statement", 0777);

  umask($oldmask);

 

}

 

The position directories already exist. Like i mentioned it creates the CV directory inside $lname_email, but it does not create the other mentioned directories.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.