yo ocupo este código:
Código PHP:
<?
function CheckExt($filename, $ext) {
$passed = FALSE;
$testExt = "\.".$ext."$";
if (eregi($testExt, $filename)) {
$passed = TRUE;
}
return $passed;
}
//Define an array of common extensions.
$exts = array("exe","swf");
$dir = opendir("TU_DIRECTORIO/");
$files = readdir($dir);
while (false !== ($files = readdir($dir))) {
foreach ($exts as $value) {
if (CheckExt($files, $value)) {
$quitar = str_replace(".swf","", $files);
echo "<a href=\"TU_DIRECTORIO/$files\" class='tah11'>$quitar</a>\n";
echo "<br>";
$count++; //Keep track of the total number of files.
break; //No need to keep looping if we've got a match.
}
}
}
//Be a good script and clean up after yourself...
closedir($dir);
?>