Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

mkdir() wont make dir

Options
  • 09-07-2008 5:59pm
    #1
    Registered Users Posts: 483 ✭✭


    im usin this code to create a directory named by $ref_num but it wont create it! im stumped been at it a long time now!
    $errors = 0;
    if(isset($_POST['submit_button']) && $error_msg != '')
    {
         $errors = 1;                      
    }
    else if(isset($_POST['submit_button']) && $error_msg == '')
    {                              
            // create folders from order number        
            exec("mkdir /HFSC/properties/$ref_num");
            chmod("/HFSC/properties/$ref_num", 0777);
                                        
    
            $uploaddir = "../properties/" . $ref_num . "/";
            if (!is_dir("$uploaddir"))  die ("The directory <b>($uploaddir)</b> doesn't exist"); 
            if (!is_writable("$uploaddir"))  die ("The directory <b>($uploaddir)</b> is NOT writable, Please Chmod (777)"); 
    }
    
    ive tried giving it the absolute path ie: D:\WAMP\xampplite\htdocs\HFSC\properties
    ive also tried different variations, any help would be great!

    Thanks
    Richie


Comments

  • Registered Users Posts: 26,579 ✭✭✭✭Creamy Goodness


    what user is the script being run by?

    can they create directories in the directory you want to be able to?


  • Registered Users Posts: 483 ✭✭banbutcher


    its been run by admin!


  • Registered Users Posts: 483 ✭✭banbutcher


    i was just lookin there in the folder properties and the read only box is checked! should that matter, as i cant remove it, all folders are read only and i cant uncheck it!

    please help
    Richie


  • Registered Users Posts: 6,509 ✭✭✭daymobrew


    [php] // create folders from order number
    exec("mkdir /HFSC/properties/$ref_num");
    chmod("/HFSC/properties/$ref_num", 0777);[/php] A quick aside, I recommend using the built in mkdir command instead of using exec. It is probably launching cmd.exe which might not understand the forward slashes.

    Checking the return value of mkdir might give more info: [php]if ( ! mkdir("/HFSC/properties/$ref_num") ) {
    print_r(error_get_last());
    }[/php]


  • Registered Users Posts: 7,518 ✭✭✭matrim


    Check to make sure all folders under it are created. e.g. if you want to create folder1 i.e. d:\home\users\folder1
    make sure you have the folder D:\home\users created first.


  • Advertisement
Advertisement