0
if(!is_dir($dir_path))
    {
        $mk_dir=mkdir($dir_path, 0777);
        $ch_mod=chmod($dir_path, 0777);
    }

In the above code I am getting errors like below:

Warning: mkdir() [function.mkdir0]: No such file or directory in E:\salaahakardb\New Folder\xampp\htdocs\extramarks2\jnrcontent\fillblanks\form_vars.php on line 66

Warning: chmod() [function.chmod0]: No such file or directory in E:\salaahakardb\New Folder\xampp\htdocs\extramarks2\jnrcontent\fillblanks\form_vars.php on line 67

Please explain

2 Answers 2

2

The parent directory of the directory you're trying to create probably doesn't exist.

One way could be to create it recursively:

mkdir($dir_path, 0777, true);

Check http://php.net/manual/en/function.mkdir.php for further info.

Also you can get rid of that chmod() since you are already setting permissions while mkdir()'ing.

Sign up to request clarification or add additional context in comments.

Comments

0

is_dir function returns false, if passed parameter is file - it's your situation. try file_exists function

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.