bofett Posted August 27, 2010 Share Posted August 27, 2010 Please help. I am simply trying to create a directory if it doesn't already exist. I am working from one site (www.mysite.com/folder1/folder2/folder3/here). I want to have this PHP script make a directory on another one of my sites (www.mysite2.com/images) $dirname = "../../mysite2.com/images"; <--this is the root directory (www.mysite2.com/images) $filename = "/$sitest/$userid/"; <-- this is the folder we want to create if it doesn't already exist (www.mysite2.com/images/us/27) $fulldirname = "$dirname$filename"; <--this should be the total path (mysite2.com/images/us/27) if (file_exists($fulldirname)) { echo "The directory {$fulldirname} exists"; } else { mkdir($fulldirname, 0777); echo "The directory {$fulldirname} was successfully created."; } Quote Link to comment https://forums.phpfreaks.com/topic/211914-mkdir-on-same-server-different-directory/ Share on other sites More sharing options...
trq Posted August 27, 2010 Share Posted August 27, 2010 And the problem is? Quote Link to comment https://forums.phpfreaks.com/topic/211914-mkdir-on-same-server-different-directory/#findComment-1104500 Share on other sites More sharing options...
bofett Posted August 28, 2010 Author Share Posted August 28, 2010 And the problem is? Here is what I get... Warning: mkdir() [function.mkdir]: No such file or directory in /home/username/mysite.com/folder1/folder2/folder3/here/myfile.php on line 29 Line 29 is mkdir($fulldirname, 0777); Quote Link to comment https://forums.phpfreaks.com/topic/211914-mkdir-on-same-server-different-directory/#findComment-1104504 Share on other sites More sharing options...
bofett Posted August 28, 2010 Author Share Posted August 28, 2010 Fixed it. mkdir($fulldirname, 0777, true); Quote Link to comment https://forums.phpfreaks.com/topic/211914-mkdir-on-same-server-different-directory/#findComment-1104517 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.