Once we have the problem of listing the contents of a directory or folder in php language in which the names of the files are computer by creation date, well, with this simple code we can obtain it easily. It is based on the creation of an array, sort it by creation date and then display it, using a li or a table, for example
$ dir = "../mydir/";
chdir ($ dir);
array_multisort (array_map ('filemtime', ($ files = glob ("*. *"))), SORT_DESC, $ files);
echo "<table>";
foreach ($ files as $ filename)
{
if ($ tr == 0)
{
echo "<tr>";
}
echo "<td> <a href='download.php?path=".$filename."' target='_blank'>" .substr ($ filename, 0, -4). "</a> </ td > ";
$ tr ++;
if ($ tr == 4)
{
echo "</ tr>";
$ tr = 0;
}
}
echo "</ table>";
Where download is the call to the script to download the file.