I'm using this code to list files on my web server:

Code:
<?php 

$folder = "articles/";
$handle = opendir($folder);

# Making an array containing the files in the current directory:
while ($file = readdir($handle))
{
    $files[] = $file;
}
closedir($handle);

#echo the files
foreach ($files as $file) {
    echo "<a href=$folder$file>$file</a>"."<br />";
}
?>
I didn't write the code, I got it from a tutorial. My PHP knowledge is very limited :S

this is probably a dumb question but.... how do I get rid of the links to the directory and only link to the files within it?

also, when I upload a file with space in its name, the link in the list won't work. how do I stop that happening?