Just enter the directory in the root of the webserver or the path to the directory and use this
<?php
$handle = "enter/the/directory/path/here";//like includes or templates/images
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file\n<br>";
}
}
closedir($handle);
}
?>
That is the readdir() function you can find that function in the list of function that are in the second link in my signature.