php.ajax.coder Posted March 29, 2009 Share Posted March 29, 2009 I have a path C:/Folder/Folder/../file.txt is there a php function to evaluate to C:/Folder/file.txt Quote Link to comment https://forums.phpfreaks.com/topic/151565-solved-file-path/ Share on other sites More sharing options...
MadTechie Posted March 29, 2009 Share Posted March 29, 2009 Huh! Quote Link to comment https://forums.phpfreaks.com/topic/151565-solved-file-path/#findComment-796060 Share on other sites More sharing options...
php.ajax.coder Posted March 29, 2009 Author Share Posted March 29, 2009 C:/Folder/Folder/../file.txt is the same as C:/Folder/file.txt but i need to evaluate the first to the second to be displayed Quote Link to comment https://forums.phpfreaks.com/topic/151565-solved-file-path/#findComment-796069 Share on other sites More sharing options...
Silverado_NL Posted March 29, 2009 Share Posted March 29, 2009 u could find out the current location of the running file with $_SERVER["SCRIPT_FILENAME"], then use the explode version to put em into an array like this. $array = explode('/',$_SERVER["SCRIPT_FILENAME"]); then from there u can work to the path u want using php's array functions and then implode em back together. Quote Link to comment https://forums.phpfreaks.com/topic/151565-solved-file-path/#findComment-796074 Share on other sites More sharing options...
corbin Posted March 29, 2009 Share Posted March 29, 2009 realpath Quote Link to comment https://forums.phpfreaks.com/topic/151565-solved-file-path/#findComment-796099 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.