hmmm i don't see the use of is_file anywhere, that is how to check for a file... there is an example on php.net that will list the directories and files, then you just play from there...
below is the simplest example i can give you, and it works, it ONLY list FILES, not directories:
<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && is_file($file)) {
echo "$file<br>";
}
}
closedir($handle);
}
?>