canadabeeau Posted December 20, 2009 Share Posted December 20, 2009 how do you open a file above the root directory? for example in the folder above the root I have a file text.txt how would I code PHP to open and view that? Link to comment https://forums.phpfreaks.com/topic/185755-open-file-above-root-directory/ Share on other sites More sharing options...
trq Posted December 20, 2009 Share Posted December 20, 2009 Pass the path to fopen. Link to comment https://forums.phpfreaks.com/topic/185755-open-file-above-root-directory/#findComment-980849 Share on other sites More sharing options...
autorubbish Posted December 20, 2009 Share Posted December 20, 2009 Initialize the function: $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'] then use the syntax: fopen = "$DOCUMENT_ROOT/Folder/file"; you can also use the "." if you know the UP amount. I hope this will help Link to comment https://forums.phpfreaks.com/topic/185755-open-file-above-root-directory/#findComment-980852 Share on other sites More sharing options...
trq Posted December 20, 2009 Share Posted December 20, 2009 Initialize the function: $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'] then use the syntax: fopen = "$DOCUMENT_ROOT/Folder/file"; you can also use the "." if you know the UP amount. I hope this will help That opens a file within a directory structure that is within the document root, not outside of it. Link to comment https://forums.phpfreaks.com/topic/185755-open-file-above-root-directory/#findComment-980853 Share on other sites More sharing options...
autorubbish Posted December 20, 2009 Share Posted December 20, 2009 specify your path e.g c:/myfile/file.txt in double quotes or c:\\myfile\\file.txt and pass it to fopen just like Thorpe said Link to comment https://forums.phpfreaks.com/topic/185755-open-file-above-root-directory/#findComment-980863 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.