pouncer Posted March 6, 2007 Share Posted March 6, 2007 im in member.php which is inside a folder called 'member' i have a folder called 'collection' which is outside this member directory. i want to create a folder inside the 'collection' folder based on the username, e.g, $_SESSION['Username'] . "_images"; so that will be like: john_images folder. i want to actually check if the folder 'john_images' doesn't already exist though. can soemone please show me how it can be done? Link to comment https://forums.phpfreaks.com/topic/41440-creating-folders/ Share on other sites More sharing options...
trq Posted March 6, 2007 Share Posted March 6, 2007 mkdir and is_dir should help you out. Link to comment https://forums.phpfreaks.com/topic/41440-creating-folders/#findComment-200764 Share on other sites More sharing options...
Daniel0 Posted March 6, 2007 Share Posted March 6, 2007 To use the functions given by thorpe, this code should do the trick: $name = "{$_SESSION['Username']}_images"; if(is_dir($name)) { mkdir($name); } Link to comment https://forums.phpfreaks.com/topic/41440-creating-folders/#findComment-200771 Share on other sites More sharing options...
pouncer Posted March 6, 2007 Author Share Posted March 6, 2007 Thanks alot guys. Should the code be if(is_dir(../collection/$name)) Link to comment https://forums.phpfreaks.com/topic/41440-creating-folders/#findComment-200801 Share on other sites More sharing options...
trq Posted March 6, 2007 Share Posted March 6, 2007 if (!is_dir('../collection/'.$name)) Link to comment https://forums.phpfreaks.com/topic/41440-creating-folders/#findComment-200804 Share on other sites More sharing options...
pouncer Posted March 6, 2007 Author Share Posted March 6, 2007 perfect thorpe, thank you buddy. Link to comment https://forums.phpfreaks.com/topic/41440-creating-folders/#findComment-200817 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.