Hi just a quick fire question with a simple problem that is causing me a lot of hassle
I am in the middle of creating a file manager (upload type thing). Everything is fine, however what I would like to do is complie a list of all files within a certain folder (any type of file), but only display the two newest files within that folder.
I was using the following to get and display the entire contents of the folder, but I am looking to use a limit as I mentioned above.
Has anyone any ideas, or atleast point me in the right direction
<?$dir = opendir("$folder_name");
while ($file[] = readdir($dir)) {
}
$num_files = count ($file);
for ($idx = 0; $idx < $num_files -1; ++$idx)
{
if ($idx < 2) {
echo (""); }
else {
echo ("$file[$idx]<BR>");
}
}?>