Hi
Instead of echoing the $file variables, add them to an array, then sort the array, then go through the array and echo from there.
$main = opendir($path);
while($file = readdir($main)) {
if ($file != "." && $file != ".." && $file != "listfiles.php3") {
$farray[] = $file;
}
}
closedir($main);
sort($farray);
for ($i; $i<count($farray); $i++) {
echo "<A href=\"$farray[$i]\" target=\"_new\">$farray[$i]</A><BR>\n";
}