Jump to content

mkdir on same server different directory


bofett

Recommended Posts

Please help.  I am simply trying to create a directory if it doesn't already exist.  I am working from one site (www.mysite.com/folder1/folder2/folder3/here).  I want to have this PHP script make a directory on another one of my sites (www.mysite2.com/images)

 

$dirname = "../../mysite2.com/images"; <--this is the root directory (www.mysite2.com/images)

$filename = "/$sitest/$userid/"; <-- this is the folder we want to create if it doesn't already exist (www.mysite2.com/images/us/27)

$fulldirname = "$dirname$filename"; <--this should be the total path (mysite2.com/images/us/27)

     if (file_exists($fulldirname)) {
         echo "The directory {$fulldirname} exists";
     } else {
       mkdir($fulldirname, 0777);
         echo "The directory {$fulldirname} was successfully created.";
     }


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.