<?
//Détermine l'extension du ficher
function fileExt($file){
$pt = strrpos($file, "." );
return substr($file, $pt+1);
}
$nbd= 0; //nb document Doc
$nbe= 0; //nb document Excel
$doc= ""; //document word
$exc= ""; //document excel
$directory= "/WHERE FILES/ARE/UPLOADED";
$handle=opendir($directory);
while ($file = readdir($handle)) {
if ($file != "." && $file != ".." ) {
// $file contient le nom d'un fichier
if( fileExt($file)=="doc" )
$doc[$nbd++]= $file;
if( fileExt($file)=="xls" )
$exc[$nbe++]= $file;
}
}
closedir($handle);
echo "<TABLE>";
echo "<TR><TH>WORD</TH><TH>Excel</TH></TR>";
$nbrow= ($nbd>$nbe) ? $nbd : $nbe;
for ($i=0; $i<$nbrow; $i++){
$fileDoc= ($i<$nbd) ? $doc[$i] : " ";
$fileExc= ($i<$nbe) ? $exc[$i] : " ";
echo "<TR><TD>$fileDoc</TD><TD>$fileExc</TD></TR>";
}
echo "</TABLE>";
?>
[edtdd]--Message édité par ethernal--[/edtdd]