<?php
//deinf the array
$filelist = array();
//check to see if the folder exists
if ($handle = opendir('/usr/bin')) {
$i=0;
//loop through the folder and store in the array
while (false !== ($file = readdir($handle))) {
$filelist[$i] = $file;
$i++;
}
closedir($handle);
}
//sort the array alphabetically
asort($filelist);
//create the select box
echo "<select multiple=yes size=10>";
//loop through the array and add the options
foreach ($filelist as $k=>$v){
echo "<option value='$k'>$v</option>";
}
echo "</select>";
?>