$dir = 'mydir';
$dp = opendir($dir) or die("diropen failed");
$files = array();
while($file = readdir($dp))
if($file != "." || $file != "..")
$files[] = $file;
closedir($dp);
foreach($files as $value) {
printf("<a href=\"%1\$s\">%1\$s</a>", $value);
}
That should work, it creates the array $files of all the usable file names 🙂