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


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

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

#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?