tags:

views:

46

answers:

1

Hi friends in my project i have a situation that when i select the drive letter it display the corresponding files with in the share drive will dispaly . for that i find the connected drives with my system using the following code
echo "<select id = 'drives'><option>Drives</option>"; for($ii=66;$ii<92;$ii++) { $char = chr($ii); if(opendir($char.":/")) echo "<option>".$char."</option>"; } echo "</select>";

But i select the drive letters the corresponding files are not displayed. Please help me to fetch the files. Thanks in advance

+1  A: 

A neat way to do it is with a DirectoryIterator:

$it = new DirectoryIterator($char . ':/');
foreach ($it as $file)
    echo $file->getFilename();

See also SPLFileInfo.

Greg