fileList.php
Source of fileList.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>fileList.php</title>
</head>
<body>
<ul>
<?php
$dp = opendir(".");
$currentFile = "";
while($currentFile !== false){
$currentFile = readDir($dp);
$filesArray[] = $currentFile;
} // end while
//sort the array in alpha order
sort($filesArray);
//write the output
$output = "";
foreach($filesArray as $aFile){
$output .= " <li><a href=\"$aFile\">$aFile</a></li> \n";
} // end foreach
print "$output";
?>
</ul>
</body>
</html>