$Three3 Posted June 21, 2010 Share Posted June 21, 2010 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. Link to comment https://forums.phpfreaks.com/topic/205369-mkdir-function-error/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 21, 2010 Share Posted June 21, 2010 "/users/$directory" A leading / on a file system path refers to the root of the current hard disk. I suspect that you want - "users/$directory" or that you want to form an absolute file system path made up of your document root path followed by /users/$directory Link to comment https://forums.phpfreaks.com/topic/205369-mkdir-function-error/#findComment-1074780 Share on other sites More sharing options...
$Three3 Posted June 21, 2010 Author Share Posted June 21, 2010 "/users/$directory" A leading / on a file system path refers to the root of the current hard disk. I suspect that you want - "users/$directory" or that you want to form an absolute file system path made up of your document root path followed by /users/$directory Thanks a lot man. That worked perfectly. Link to comment https://forums.phpfreaks.com/topic/205369-mkdir-function-error/#findComment-1074784 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.