tags:

views:

32

answers:

2

Hi everyone, I am stuck on a simple script. I have tried Googling it and I have tried all of the stuff I found on Google but none of it has worked for me. I am trying to you the mkdir function but I keep getting an error that says: Warning: mkdir() [function.mkdir]: No such file or directory in /home/content/l/i/n/web/html/php/mkdir.php on line 6

Here is my code:

<?php

//Create the directory for the user
$directory = time() . rand(0, 49716) ;

if (mkdir("/users/$directory", 0777)) {
    echo '<p>Directory was created successfully.</p>' ;
} else {
    echo '<p>Directory was NOT created.</p>' ;
}

?>

I am placing the script called mkdir.php in the same folder as the users folder. The users folder has the permissions set to 0777. I am not sure why I keep getting this error because the users folder does exists. Any help is greatly appreciated.

+2  A: 
if (mkdir("users/$directory", 0777)) {

:-)

cypher
+1  A: 

Nevermind I figured it out. It was just that the first slash in "/users/$directory" should be "users/$directory".