jr8rdt Posted May 2, 2008 Share Posted May 2, 2008 I would like to get the file in d:\uploaded_logs\<directory_ based_on_chartID\filenames how to do that? $chart_id = $_REQUEST['id1']; $fp_mr = file('d:\uploaded_logs\' . $chart_id . '\Average.txt'); $fp_realtime = file('d:\uploaded_logs\' .$chart_id . '\grand.txt'); it doesn't work what is the correct way to do it ? Link to comment https://forums.phpfreaks.com/topic/103899-combining-directory-name-and-string-in-file-open/ Share on other sites More sharing options...
Fadion Posted May 2, 2008 Share Posted May 2, 2008 Ure using an absolute directory, one that apache hasnt got any privileges. Make them relative to the base web directory. Ex: file('logs/' . $chard_id . '/average.txt'); Link to comment https://forums.phpfreaks.com/topic/103899-combining-directory-name-and-string-in-file-open/#findComment-531893 Share on other sites More sharing options...
jr8rdt Posted May 2, 2008 Author Share Posted May 2, 2008 I am using windows as for the php server. the htdoc directory is in c: drive the log is in d: drive how can I do it? Link to comment https://forums.phpfreaks.com/topic/103899-combining-directory-name-and-string-in-file-open/#findComment-531896 Share on other sites More sharing options...
Fadion Posted May 2, 2008 Share Posted May 2, 2008 It doesnt matter where htdocs is, being it c:, d:, or c:\windows. U have to open/include files based on that directory. So if u have your files in c:\htdocs\logs\myfile.txt, u have to call it "logs/myfile.txt". Htdocs is your web server's root directory and u cant access others. About the logs in the d: drive, move them to htdocs, thats the only way. Link to comment https://forums.phpfreaks.com/topic/103899-combining-directory-name-and-string-in-file-open/#findComment-531910 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.