phppaper Posted March 29, 2008 Share Posted March 29, 2008 I wish to know how to write a directory path 2 level above the file. for example I am inside the directory /levelone/leveltwo/levelthree I want to write a php file point to a file in "levelone" directory, how to write the path to point to a directory 2 level above the file?? Quote Link to comment https://forums.phpfreaks.com/topic/98435-path-of-a-directory-2-level-above/ Share on other sites More sharing options...
beebum Posted March 29, 2008 Share Posted March 29, 2008 ../.. Quote Link to comment https://forums.phpfreaks.com/topic/98435-path-of-a-directory-2-level-above/#findComment-503770 Share on other sites More sharing options...
keeB Posted March 29, 2008 Share Posted March 29, 2008 $above = dirname(__FILE__) . "/../../myfile.php"; Quote Link to comment https://forums.phpfreaks.com/topic/98435-path-of-a-directory-2-level-above/#findComment-503774 Share on other sites More sharing options...
mkoga Posted March 29, 2008 Share Posted March 29, 2008 not the prettiest, but: $file = dirname(dirname(dirname(__FILE__))) . "myfile.php"; Quote Link to comment https://forums.phpfreaks.com/topic/98435-path-of-a-directory-2-level-above/#findComment-503831 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.