The following is a code snippet from a script I wrote for a client. It grabs the contents and creates links on the page associated with any files in the dir. So, he uploads a pic, and it is automatically added to his site.
Needless to say, it works. I can't see anything wrong with your code, but maybe this helps. If it does not, then there is really only one thing to explain your problem:
bloody windows!
<?
$destDir = "images/";
$dp = opendir($destDir);
while($current = readdir($dp)){
if($current != "." && $current != ".."){
print("<a href=\"".$destDir.$current."\">$current</a><br>\n");
}
}
?>