hobbiton73 Posted December 28, 2011 Share Posted December 28, 2011 Hi, I wonder whether someone may be able to help me please. I'm fairly new to PHP so please bear with me. I'm trying to put together a script which bascially creates a hierarchical tree of folders upon a new account being created by a user. I would like to take the 'username' that the user registers with to use as the name for the first folder, then, create a folder at the second level called 'images' and then finally, a folder within that called 'thumbs'. From the research that I've done, I believe that I need to use the 'mkdir' command, but I can't find a very straight forward tutorial. I just wondered whether someone could perhaps please help me out with this, so that I at least have a good solid starting point. Quote Link to comment https://forums.phpfreaks.com/topic/253957-mkdir-upon-new-registration/ Share on other sites More sharing options...
The Little Guy Posted December 28, 2011 Share Posted December 28, 2011 Something like this: $root = "/path/to/users/"; $username = $_POST["username"]; // A pre-validated username if(!is_dir($root.$username)) mkdir($root.$username); if(!is_dir($root.$username."/images")) mkdir($root.$username."/images"); if(!is_dir($root.$username."/images/thumbs")) mkdir($root.$username."/images/thumbs"); Quote Link to comment https://forums.phpfreaks.com/topic/253957-mkdir-upon-new-registration/#findComment-1301878 Share on other sites More sharing options...
hobbiton73 Posted December 28, 2011 Author Share Posted December 28, 2011 Hi, that's great. Thank you very much for your help. Kind regards Chris Quote Link to comment https://forums.phpfreaks.com/topic/253957-mkdir-upon-new-registration/#findComment-1301879 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.