-1
Hello. I am a beginner in programming and I am developing a project. I have already performed the code to upload the file, now I would like to list these files in a table and it shows a column with the name file and another column with the date attached (according to the time in the database):
<body>
<h3>Arquivos Adicionados:</h3>
<?php
$path = "upload/";
$diretorio = dir($path);
echo "<div class='table-responsive'>";
echo "<table class='table'>";
echo "<thead class='thead-dark'>";
echo "<tr>";
echo "<th>Nome</th>";
echo "<th>Data/Hora</th>";
echo "</tr>";
echo "</thead>";
while($arquivo = $diretorio -> read()){
echo "<tbody>";
echo "<tr>";
echo "<td><a href='".$path.$arquivo."' style='text-decoration:none'>".$arquivo."</a></td>";
echo "<td>" ??? "</td>";
echo "</tr>";
echo "</tbody>";
}
echo "</table><br>";
$diretorio -> close();
?>
<a href="add_arquivos.php"><button class="btn btn-primary">Inserir +</button></a>
</body>
Thank you very much, Romeo. I added $path to the code and it looked like this: echo "<td>". date ("d/m/Y", filemtime($path.$file))." </td>"; Because I was returning the date January 01 1970. But now I gave it right. Thanks anyway
– mais2
Yes, well remembered, I had forgotten to add the path to the files.... Then it always returns 0 because the file may be non-existent.....
– Romeu Gomes - Brasap