You can use the script below to create a custom directory list page. This is a basic script that can be customized to achieve the look you want. The script will automatically generate and link list of all the files in the directory that are of the types specified in the array variable, and only those file types. Populate the array with file types in lower case only, the script will match case insensitive. This is a good companion script to the File Upload Upload script on this page.
Code: Select all
<?php
$type = array(".jpg",".gif",".txt");
$dir = "./";
foreach(scandir($dir) as $file) {
if (in_array(strtolower(strrchr($file,'.')),$type)) echo "<a href='$file'>$file</a><br>";
}
?>
You can reverse the file type test so all files except those with the specified file types are included in the list by changing the if test line to use this test:
Code: Select all
if (!in_array(strtolower(strstr($file,'.')),$type))
You can combine this with the Tracking and Securing Downloads Script by changing the <a href= in the script to this:
Code: Select all
<a href='download.php?file=$file_select'>