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.";
     }


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.