daveoffy Posted February 28, 2009 Share Posted February 28, 2009 Hello, I am trying to make it so it will make a folder with the username. I have this and it works mkdir('../sites/test', 0777); but when I do this it doesn't mkdir('../sites/'.$username, 0777); Link to comment https://forums.phpfreaks.com/topic/147333-solved-mkdir/ Share on other sites More sharing options...
Cory94bailly Posted February 28, 2009 Share Posted February 28, 2009 Hello, I am trying to make it so it will make a folder with the username. I have this and it works mkdir('../sites/test', 0777); but when I do this it doesn't mkdir('../sites/'.$username, 0777); Try this: mkdir('../sites/{$username}', 0777); Link to comment https://forums.phpfreaks.com/topic/147333-solved-mkdir/#findComment-773360 Share on other sites More sharing options...
daveoffy Posted February 28, 2009 Author Share Posted February 28, 2009 Doesn't work. I get error Warning: mkdir() [function.mkdir]: No such file or directory Link to comment https://forums.phpfreaks.com/topic/147333-solved-mkdir/#findComment-773362 Share on other sites More sharing options...
Blunketts dog Posted February 28, 2009 Share Posted February 28, 2009 try this: mkdir('../sites/.$username', 0777); Link to comment https://forums.phpfreaks.com/topic/147333-solved-mkdir/#findComment-773366 Share on other sites More sharing options...
daveoffy Posted February 28, 2009 Author Share Posted February 28, 2009 try this: mkdir('../sites/.$username', 0777); Made the folder named .$username *EDIT* I did this and it worked mkdir('../sites/'.$username); Link to comment https://forums.phpfreaks.com/topic/147333-solved-mkdir/#findComment-773367 Share on other sites More sharing options...
DarkSuperHero Posted February 28, 2009 Share Posted February 28, 2009 //my response while you responded... :-P <?php //i think this is inside literal so you might get a dir named.. .$username ..literally mkdir('../sites/.$username', 0777); are you trying to do any error reporting or anything... try this.... <?php function handleError() { trigger_error('MY ERROR'); /** usage sample @handleError(); echo $php_errormsg; */ } // detect slash/backslash nomenclature dirname $path = dirname( __FILE__ ); $slash = '/'; strpos( $path, $slash ) ? '' : $slash = '\\'; define( 'BASE_DIR', $path . $slash ); $folder = '../sites/'.$username; // folder name $dirPath = BASE_DIR . $folder; // folder path // print results echo $slash; echo '<hr>'; $rs = @mkdir( $dirPath, '0777' ); @handleError(); if( $rs ) { // print success information echo 'was done!'; echo '<br>folder: <a href="' . $folder . '">' . $folder . '</a>'; echo '<br>dirPath: ' . $dirPath; }else{ // print error information echo 'an error was occurred. Attempting create folder'; echo '<br>dirPath: ' . $dirPath; echo '<br>php_errormsg: ' . $php_errormsg; } ?> Link to comment https://forums.phpfreaks.com/topic/147333-solved-mkdir/#findComment-773368 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.