Hi,
There are two php functions called "opendir" and "readdir". By using these functions, you can easily create a simple php script to generate download links for the files located in the directory you assigned.
For example, WARNING! script below is not tested, but I am confident this will work in the absensce of the any syntax errors.
<?php
function this_download($dir,$extension){
## use opendir please see referenced link above
if ($handle = opendir($dir)) {
## cycle items in the directory
while (false !== ($entry = readdir($handle))) {
## get show only the file extension you want downloaded
## otherwise just remove this
if(substr(strrchr($entry, '.'), 1) === $extension){
## generate the download link
echo '<a href="'. $entry .'">Download This file</a>';
}
}
}
to use the function above just supply the dir and the file extension you want the download link generated.
## sample usage
$createDownloadLink = this_download('downloadDir', 'flv');
please read opendir and readdir as referenced above.