Checking files
Posted: Mon Sep 08, 2003 2:06 am
Hi,
I wondering anyone can help me with this please.
I had a drop down menu list which displays all the files in the folder.
Can anyone please tell me, how am I going to display only the lastest 10 files in the drop down menu. e.g I have 25 files in the folder, but I only want the lastest 10 files to be in the drop down menu for users to download.
Can anyone out there please help me. Thanks.
Regards...
Fernado
I wondering anyone can help me with this please.
I had a drop down menu list which displays all the files in the folder.
Can anyone please tell me, how am I going to display only the lastest 10 files in the drop down menu. e.g I have 25 files in the folder, but I only want the lastest 10 files to be in the drop down menu for users to download.
Can anyone out there please help me. Thanks.
Code: Select all
<?php
if (isset($actionflag) && $actionflag == "download")
{
$passing = $selectXYZ;
}
htmlheader(); // prints html header
$dir = "./"; // current directory
// Print the directory name as a heading title
$filedir = getcwd(); // get current dir
$dirname = getHeader($filedir);
print "<br>";
print "<font size=+1 face="Times New Roman" color="Blue"><b> ";
print "$dirname </b>";
print "</font> ";
print "<hr>";
$file_array = array();
$file_array = getFiles($dir); // displays all the files in the folder
print "<form action="openFiles.php " name="selection" target="_blank">";
print "<input type="hidden" name="actionflag" value="download">";
print "<select name="selectXYZ">";
foreach($file_array as $a_row)
{
// make sure it's not an include file or index file
if (!strstr($a_row,".inc.php") && !strstr($a_row,"index.php") && !strstr($a_row, ".php"))
{
if (!is_dir($a_row)) // the file is not a directory
{
print "<option>$a_row</option>";
}
}
}
print "</select> ";
print "<input type="submit">";
print "</form>";
?>Fernado