Jump to content

Simple Path Problem..!!


daxguy

Recommended Posts

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?

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

<?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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.