0
This php script lists files in directory, would like to add the file size column in Mb, but am not succeeding, follow script:
<?php
$path = "arquivos/";
// Título
echo "<h2>Lista de Arquivos:</h2><br />";
// Abre a tabela, cria títulos
echo "<table>";
echo "<tr> <th>Nome</th>
<th>Tamanho</th>
</tr>";
// Loop que gera registros
foreach (new DirectoryIterator($path) as $fileInfo) {
if($fileInfo->isDot()) continue;
// Imprime linhas de registros
echo "<tr>
<td>
<a href='".$path.$fileInfo->getFilename() ."'>".$fileInfo->getFilename()."</a><br/>
</td>
<a >".filesize($fileInfo->getFilename())."</a><br/>
</tr>";
}
// Fecha a tabela
echo "</table>";
?>
working perfectly!
– Miguel Silva
script working: http://educar.esy.es/installers/
– Miguel Silva
I changed the second IF, with only one division
/1024
for kb. Hit your.– rbz
Settled and settled!
– Miguel Silva