acctman Posted May 28, 2009 Share Posted May 28, 2009 is mkdir("/home/site/public_html/rimgs/"); the same as mkdir("/rimgs/"); also would I ever run into a situation where the complete path would be needed over a shorten... Quote Link to comment https://forums.phpfreaks.com/topic/159968-solved-directory-path-question/ Share on other sites More sharing options...
Maq Posted May 28, 2009 Share Posted May 28, 2009 No. '/' will go to the root directory. There are few cases where you need to hard-code a path. If you're in the directory "public_html" you can use: mkdir("rimgs"); and it will create the foldef "rimgs" in the public_html dir. Quote Link to comment https://forums.phpfreaks.com/topic/159968-solved-directory-path-question/#findComment-843791 Share on other sites More sharing options...
acctman Posted May 28, 2009 Author Share Posted May 28, 2009 No. '/' will go to the root directory. There are few cases where you need to hard-code a path. If you're in the directory "public_html" you can use: mkdir("rimgs"); and it will create the foldef "rimgs" in the public_html dir. so it would always be good to use the "/" to start at the root just to make sure where ever the script is processed it the folder is created in the right area. thanks for the info Quote Link to comment https://forums.phpfreaks.com/topic/159968-solved-directory-path-question/#findComment-843795 Share on other sites More sharing options...
Maq Posted May 28, 2009 Share Posted May 28, 2009 No. For portability reasons you should use relative paths. Your development environment and production environment should maintain the same directory structure, even if it's from windows to linux. i.e. Your folder structure looks like this: /dir1/dir2/includes/ /dir1/dir2/main/ You're currently in the 'main' directory and you want to create a folder called 'rimgs' in the includes folder. You would code it like: mkdir("../includes/rimgs"); Quote Link to comment https://forums.phpfreaks.com/topic/159968-solved-directory-path-question/#findComment-843797 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.