tags:

views:

262

answers:

3

I am doing one project, in which I want to access the folders from remote system connected via LAN.

From that I have a drop down list. When I select the remote system drive letter (eg: c:, d:) the corresponding files in that folder will displayed in my system.

Is there any tutorial for this?

I've tried this, but it works for local system only and also I am not able to open the corresponding files.

<html>
    <head>
        <title>Drive contents</title>
    </head>
    <body>
    </body>
    <?php // Php starts here
    $myDirectory = opendir("C:\Dream");
    $path = "c:";
    // get each entry
    while($entryName = readdir($myDirectory)) {
        $dirArray[] = $entryName;
    }
    // close directory
    closedir($myDirectory);

    //    count elements in array
    $indexCount = count($dirArray);
    Print ("$indexCount files<br>\n");

    // sort 'em
    sort($dirArray);
    // print 'em
    // loop through the array of files and print them all
    for($index=0; $index < $indexCount; $index++) {
        if (substr("$dirArray[$index]", 0, 1) != "."){ // don't list hidden files
            print("<a href=\"$dirArray[$index]\">$dirArray[$index]</a>");
            echo "<br>";
        }
    }
?>
</html>
A: 

Look at php stream functions and function glob

$myDirectory = opendir("Y:\\logs");

Stream functions can open remote dirs

\\smbserver\share\path\to\winfile.ext
SM
+1  A: 

Where is your PHP script running? Just to better understand, where is your script? Is the script running in the same machine as the remote files or is the script in a different location?

Anyway, for both cases you should first check if php safe_mode directive is on or off and also the value of the open_basedir directive because they can block you for accessing certain directories.

But if the script is in a different server you should also check the permissions of the remote server directories and verify if the allow_url_fopen directive in php.ini is set to "On".

fromvega
A: 

instead of http:// prefix, try using the file:/// prefix in your ahrefs

Justin Lawrence