Hello everybody,

Here's my code to scan a particular directory and show all files with a checkbox next to each filename. My client just want to show these filenames sorted alphabetically.

Code:
$dir = "../download/";
$i=0;
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
    print "<tr><td height='25'></td></tr>";
        while (($file = readdir($dh)) != false) {
            // print "filename: $file : filetype: " . filetype($dir . $file) . "\n";
            if(filetype($dir . $file)!='dir' and !in_array($file,$att))
            {
				$i++;
				//echo "";
				print "<tr><td class='caption'>" . "<a href='$dir$file'>" . $file . "</td>";
				if($_GET[id]=="admin")
					print"<td class='caption'><input type='checkbox' name='chk$i' value='$file'></td>";
				else
					print"<td class='caption'></td>";
			};
        }
    closedir($dh);
    }
}
Thanks.