pneudralics Posted April 20, 2009 Share Posted April 20, 2009 I was looking at mkdir() but didn't really get it. Tried mkdir("pathgoeshere", 0700); All I get is file exists. I want to make a folder inside of a folder and be able to name it at the same time. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/154896-solved-how-do-i-make-a-subfolder-inside-of-a-folder/ Share on other sites More sharing options...
Maq Posted April 20, 2009 Share Posted April 20, 2009 I want to make a folder inside of a folder and be able to name it at the same time. That's what mkdir does. Can you post the exact path? It should be i.e. "path/new_dir_name" Quote Link to comment https://forums.phpfreaks.com/topic/154896-solved-how-do-i-make-a-subfolder-inside-of-a-folder/#findComment-814725 Share on other sites More sharing options...
pneudralics Posted April 20, 2009 Author Share Posted April 20, 2009 <?php mkdir("C:\wamp\www\", 0700); ?> Does the new name go after www\? The above gives me the error: Warning: mkdir() [function.mkdir]: Invalid argument in C:\wamp\www\test.php on line 2 Quote Link to comment https://forums.phpfreaks.com/topic/154896-solved-how-do-i-make-a-subfolder-inside-of-a-folder/#findComment-814868 Share on other sites More sharing options...
Maq Posted April 20, 2009 Share Posted April 20, 2009 Yes, the name of the directory goes in the path, how else would it know the directory name you're trying to create? The reason for the error is because you need to escape the forward slashes, it's escaping the quote which creates an invalid argument. mkdir("C:\\wamp\\www\\new_dir", 0700); Quote Link to comment https://forums.phpfreaks.com/topic/154896-solved-how-do-i-make-a-subfolder-inside-of-a-folder/#findComment-814873 Share on other sites More sharing options...
MatthewJ Posted April 20, 2009 Share Posted April 20, 2009 Not to be picky... but those are backslashes Forward slashes lean forward Quote Link to comment https://forums.phpfreaks.com/topic/154896-solved-how-do-i-make-a-subfolder-inside-of-a-folder/#findComment-814877 Share on other sites More sharing options...
Maq Posted April 20, 2009 Share Posted April 20, 2009 Not to be picky... but those are backslashes Forward slashes lean forward Ah yes, you're right. I'm on a linux system so my slashes are always forward. Quote Link to comment https://forums.phpfreaks.com/topic/154896-solved-how-do-i-make-a-subfolder-inside-of-a-folder/#findComment-814883 Share on other sites More sharing options...
MatthewJ Posted April 20, 2009 Share Posted April 20, 2009 Yeah... that stupid windows! Always has to be different hehe Quote Link to comment https://forums.phpfreaks.com/topic/154896-solved-how-do-i-make-a-subfolder-inside-of-a-folder/#findComment-814885 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.