I need to open a folder, list the directories, have the user select the directory of choice (it will be a date), then be presented with a list of pdf files to choose to open. Tried this:
<?php
$uploadDir = 'files/lap_times';
if ($handle = opendir($uploadDir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$file_arr[] = $file;
}
}
closedir($handle);
}
natcasesort($file_arr);
foreach ($file_arr as $file) {
echo "<b><div class='item'><a href='files/lap_times/" . $file . "' target='_blank'>" . $file . "</a></div></b><p>";
}
?>
and it get's me the pdf's. Tried having it get me the folders, but it left the root open, so I changed it to just show the pdf files. I then zip the previous weeks, and present that as a file choice. Not exactly what I want. So, there would be a folder [Lap_times], and under it subs with dates <8-10-13>, <8-3-13>. In those folders would reside the pdf files. The user could select a date, which would then open a folder of pdf's. And select the one they need, and be done. Have I explained it well enough?