SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post creating folder in root directory

    Hi, I need some help how can i create folder in the root directory.

    my script for creating the folder is in the folder called folder1, this is the path C:\wamp\www\ABC\folder1

    now what i want is to create a folder outside in my "folder1" named "xyz".


    this is the code for creating and checking but the new folder (xyz) will be created inside my folder1 how can i create outside in my folder1
    Code:
      $folder = 'xyz';
      
      if(!is_dir($folder)){
                mkdir($folder));
           }

    Thank you in advance.

  2. #2
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,206
    Mentioned
    74 Post(s)
    Tagged
    3 Thread(s)
    Try:
    PHP Code:
     $folder '/xyz';
      
      if(!
    is_dir(dirname($folder))){
                
    mkdir(dirname($folder));
           } 

  3. #3
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, it doesn't create the folder.

  4. #4
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Rubble View Post
    Try:
    PHP Code:
     $folder '/xyz';
      
      if(!
    is_dir(dirname($folder))){
                
    mkdir(dirname($folder));
           } 
    Hi fixed it now...Thank you


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •