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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.