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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

mkdir() wont make dir

  • 09-07-2008 4:59pm
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 Posts: 26,584 ✭✭✭✭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, Registered Users 2 Posts: 483 ✭✭banbutcher


    its been run by admin!


  • Registered Users, Registered Users 2 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, Registered Users 2 Posts: 6,571 ✭✭✭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, Registered Users 2 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