daxguy Posted December 29, 2010 Share Posted December 29, 2010 I have a script.. it works fine on my localhost.. now i am trying to work it with on my remote server.. the script reads the folder in my c drive and shows me the file on display here is the code <?php $main_dir ="C:\\xampp\\htdocs\\xtrajam"; $main_open = opendir($main_dir); while(($main_file = readdir($main_open)) != FALSE) { echo $main_file."<br />"; } closedir($main_open); ?> Now the thing is this works fine on local host as it can easy access the path C:\\xampp\\htdocs\\xtrajam Now i want this path to be accessed sumhow wen i try it on my remote server.. how should i do that like when i run the script online it reads the contents from my c drive directory..? is it sumhow possible? Quote Link to comment https://forums.phpfreaks.com/topic/222937-simple-path-problem/ Share on other sites More sharing options...
daebat Posted December 29, 2010 Share Posted December 29, 2010 install a phpinfo file, find your document root, use that file structure. Quote Link to comment https://forums.phpfreaks.com/topic/222937-simple-path-problem/#findComment-1152706 Share on other sites More sharing options...
daxguy Posted December 29, 2010 Author Share Posted December 29, 2010 umm i didnt get wat u mean? Quote Link to comment https://forums.phpfreaks.com/topic/222937-simple-path-problem/#findComment-1152709 Share on other sites More sharing options...
daebat Posted December 29, 2010 Share Posted December 29, 2010 You have webspace correct? Create a php file named phpinfo.php in the root directory and place this snippet of code in it: <?php phpinfo(); ?> Next go to whatever your domain is /phpinfo.php (example: http://mysite.com/phpinfo.php) This will tell you all kinds of statistics about your site. Go to the bottom and it will have an area that will state "document root" and it should look something like this: /var/myname/home/content/87/64090/html/ (the above was an example from godaddy... most aren't as complex as this). Quote Link to comment https://forums.phpfreaks.com/topic/222937-simple-path-problem/#findComment-1152712 Share on other sites More sharing options...
daxguy Posted December 29, 2010 Author Share Posted December 29, 2010 here is the info that i have found by the procedure u told me.. what should i do with this _SERVER["DOCUMENT_ROOT"] /var/chroot/home/content/36/6817636/html Quote Link to comment https://forums.phpfreaks.com/topic/222937-simple-path-problem/#findComment-1152714 Share on other sites More sharing options...
daebat Posted December 29, 2010 Share Posted December 29, 2010 <?php $main_dir ="/var/chroot/home/content/36/6817636/html/xtrajam"; $main_open = opendir($main_dir); while(($main_file = readdir($main_open)) != FALSE) { echo $main_file."<br />"; } closedir($main_open); ?> assuming that you have placed a folder named 'xtrajam' in your webspace. Quote Link to comment https://forums.phpfreaks.com/topic/222937-simple-path-problem/#findComment-1152737 Share on other sites More sharing options...
daxguy Posted December 29, 2010 Author Share Posted December 29, 2010 NO i am not trying to access the webspace folder.. i am trying to access the folder from my PC.. like the path i mentioned in my 1st post.. like my site is http://mysite.php/access_folder.php is were the script is.. i want to read a folder in my C drive of my PC.. C:/xampp/xtrajam .. i want the contents of this folder to be displayed not the folder on the webspace Quote Link to comment https://forums.phpfreaks.com/topic/222937-simple-path-problem/#findComment-1152743 Share on other sites More sharing options...
daebat Posted December 29, 2010 Share Posted December 29, 2010 Let me get this straight... you want a script to read and run from your hard drive? Quote Link to comment https://forums.phpfreaks.com/topic/222937-simple-path-problem/#findComment-1152746 Share on other sites More sharing options...
daxguy Posted December 29, 2010 Author Share Posted December 29, 2010 no i want a script that runs on mywebspace nd read from my hard drive is that possible? Quote Link to comment https://forums.phpfreaks.com/topic/222937-simple-path-problem/#findComment-1152747 Share on other sites More sharing options...
daebat Posted December 29, 2010 Share Posted December 29, 2010 I really don't know that it would be running from your hard drive without some sort of extra software bridge that connects the two. You're talking some high level stuff. Good luck! Quote Link to comment https://forums.phpfreaks.com/topic/222937-simple-path-problem/#findComment-1152752 Share on other sites More sharing options...
daxguy Posted December 29, 2010 Author Share Posted December 29, 2010 Thanks for all your help Quote Link to comment https://forums.phpfreaks.com/topic/222937-simple-path-problem/#findComment-1152753 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.