aqui te pongo un ejemplo:
Código PHP:
<html>
<head>
<title>Crysfel Storage Page</title>
<link href="http://pulso.um.edu.mx/~crysfel/icons/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
echo "<h1>".getcwd()."</h1>";
echo "\n<h2><a href=\"..\">Subir nivel</a></h2>\n<table border=\"0\" align=\"center\">";
$dirr=opendir('.');
$i=1;
while ($file=readdir($dirr)) {
if ($file!='..' && $file!='.' && $file!='' && $file!='index.php')
{
if($i==1)
echo "\n\t<tr>";
if (is_dir($file)) {
echo "\n\t\t<td width=\"200\"><a href=\"".$file."\"><img src=\"http://pulso.um.edu.mx/~crysfel/icons/".getIcon()."\" border=0 alt=\"".size_archivo($file)."\"></a><br><a href=\"".$file."\">".$file."</a></td>";
} else {
echo "\n\t\t<td width=\"200\"><a href=\"".$file."\"><img src=\"http://pulso.um.edu.mx/~crysfel/icons/".getIcon($file)."\" border=0 alt=\"".size_archivo($file)."\"></a><br><a href=\"".$file."\">".$file."</a></td>";
}
if($i==3){
echo "</tr>";
$i=0;
}
$i++;
}
}
closedir($dirr);
if($i==2)
echo "<td width=\"200\"> </td><td width=\"200\"> </td></tr>";
if($i==3)
echo "<td width=\"200\"> </td></tr>";
echo "</table>";
//**************************
// FUNCIONES
//**************************
function size_archivo($file) {
$size = filesize($file);
$sizes = Array('Bytes', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb');
$ext = $sizes[0];
for ($i=1; (($i < count($sizes)) && ($size >= 1024)); $i++) {
$size = $size / 1024;
$ext = $sizes[$i];
}
return round($size, 2)." ".$ext;
}
function getIcon($archivo = "1"){
if($archivo!=1)
$typeFile = substr($archivo,strlen($archivo)-3);
else
$typeFile = "carpeta";
$typeFile = strtolower($typeFile);
switch($typeFile){
case "carpeta" : $icon = "folder.png"; break;
case "jpg" : $icon = "jpg.png"; break;
case "gif" : $icon = "gif.png"; break;
case "png" : $icon = "png.png"; break;
case "pdf" : $icon = "pdf.png"; break;
case "htm" : $icon = "html.png"; break;
case "tml" : $icon = "html.png"; break;
case "mp3" : $icon = "mp3.png"; break;
case "exe" : $icon = "exec.png"; break;
default : $icon = "file.png"; break;
}
return $icon;
}
?>
Donde pongas ese archivo, te va a mostrar el contenido de la carpeta donde se encuentre este, te pone unos icons dependiendo del tipo de archivo y te muestra el peso de cada fichero
have funn