Forum Moderators: coopster
This must be easy to do right?
I have the following script, but i need it to display pdf files only from that folder. I've figured that the allowed types should be in an array, but how do i use that to display only pdf's? Ive looked at the filetype() function but that came to a dead end.
<?php
$dir = "downloads/files/";
$allowedTypes = array('pdf');
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
echo "<a href=\"downloads/?file=$file\">$file</a><br />";
}
closedir($dh);
?>
Thanks
:)