scanning a client-side directory
Posted: Wed Feb 04, 2009 8:10 am
Hi,
Is it possible for the remote client to run scandir() from my web server to scan his/her directories? At the moment scandir() is returning a list of directories on the server side. I need the function to scan the directory of who ever is accessing the web server. i.e. on the web server there might be these directories:
D:\Folder1a
D:\Folder1b
D:\Folder1c
On the Client accessing the site, he / she might have these directories:
D:\Folder2a
D:\Folder2b
D:\Folder2c
When the page is accessed, it is obviously shows:
Folder1a, Folder1b, Folder1c
I need it to show:
Folder2a, Folder2b, Folder2c
here is my code:
//collects the drive from the previous page's post, this works as it echo's out
$dir = $_POST['drive'];
//check that the directory exists -- my working function that just confirms it is a valid drive or ends
check_dir($dir);
$list = array_diff( scandir( $dir ), Array( ".", "..", "Thumbs.db" ) );
foreach($list as $folder)
{
if(is_dir($folder))
{
echo "$folder<br>";
}
}
Any help advice would be much appreciated!
Many thanks
Is it possible for the remote client to run scandir() from my web server to scan his/her directories? At the moment scandir() is returning a list of directories on the server side. I need the function to scan the directory of who ever is accessing the web server. i.e. on the web server there might be these directories:
D:\Folder1a
D:\Folder1b
D:\Folder1c
On the Client accessing the site, he / she might have these directories:
D:\Folder2a
D:\Folder2b
D:\Folder2c
When the page is accessed, it is obviously shows:
Folder1a, Folder1b, Folder1c
I need it to show:
Folder2a, Folder2b, Folder2c
here is my code:
//collects the drive from the previous page's post, this works as it echo's out
$dir = $_POST['drive'];
//check that the directory exists -- my working function that just confirms it is a valid drive or ends
check_dir($dir);
$list = array_diff( scandir( $dir ), Array( ".", "..", "Thumbs.db" ) );
foreach($list as $folder)
{
if(is_dir($folder))
{
echo "$folder<br>";
}
}
Any help advice would be much appreciated!
Many thanks