BigDC Posted October 8, 2009 Share Posted October 8, 2009 Hello, I am on a hosting account that has PHP Version 5.2.9. I am trying to create sub directories within a directory. The script I use is in a sub directory named members inside my home directory, my home directory is /home/playerz, and my public html html directory path is /home/playerz/public_html. I get info from a form using $_POST['memberType'] and $_POST['userName'], and and then I am trying to create sub directories inside of the members sub directory So the sub directories with the structures I want to create are: /members/$memberType/$userName /members/$memberType/$userName/mp3 /members/$memberType/$userName/images /members/$memberType/$userName/include Here is my code so far: $memberType = $_POST['memberType']; $userName = $_POST['userName']; $thisdir = dirname("/members/{$memberType}/{$userName}"); mkdir($thisdir, 0777); $thisdir = dirname("/members/{$memberType}/{$userName}/mp3"); mkdir($thisdir, 0777); $thisdir = dirname("/members/{$memberType}/{$userName}/images"); mkdir($thisdir, 0777); $thisdir = dirname("/members/{$memberType}/{$userName}/include"); mkdir($thisdir, 0777); When I use this code, I get the following errors: Warning: mkdir() [function.mkdir]: No such file or directory in /home/playerz/public_html/accountcreated.php on line 47 Warning: mkdir() [function.mkdir]: No such file or directory in /home/playerz/public_html/accountcreated.php on line 49 Warning: mkdir() [function.mkdir]: No such file or directory in /home/playerz/public_html/accountcreated.php on line 51 Warning: mkdir() [function.mkdir]: No such file or directory in /home/playerz/public_html/accountcreated.php on line 53 I have checked to make sure that $memberType and $userName are getting the variables posted to them, and they are. Please help? Link to comment https://forums.phpfreaks.com/topic/176924-solved-trying-to-create-subdirectories/ Share on other sites More sharing options...
MadTechie Posted October 8, 2009 Share Posted October 8, 2009 does /members/{$memberType} exist ? also dirname should be used with FILE paths try mkdir("/members/{$memberType}", 0777); mkdir("/members/{$memberType}/{$userName}",0777); mkdir("/members/{$memberType}/{$userName}/mp3",0777); mkdir("/members/{$memberType}/{$userName}/images",0777); mkdir("/members/{$memberType}/{$userName}/include",0777); Link to comment https://forums.phpfreaks.com/topic/176924-solved-trying-to-create-subdirectories/#findComment-932826 Share on other sites More sharing options...
fooDigi Posted October 8, 2009 Share Posted October 8, 2009 you're trying to create the directories in the root of the drive... you should include your home directory before '/members/....' $thisdir = dirname("/home/playerz/members/{$memberType}/{$userName}"); or really just... $thisdir = "/home/playerz/members/$memberType/$userName"; Link to comment https://forums.phpfreaks.com/topic/176924-solved-trying-to-create-subdirectories/#findComment-932827 Share on other sites More sharing options...
BigDC Posted October 8, 2009 Author Share Posted October 8, 2009 .....or really just... $thisdir = "/home/playerz/members/$memberType/$userName"; That worked, thanks Link to comment https://forums.phpfreaks.com/topic/176924-solved-trying-to-create-subdirectories/#findComment-932830 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.