This php script lists files in directory, I would like to add the file size column in Mb, but I am not succeeding, script follows:
<?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>";
?>