Code: Select all
<?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 />";
}
?>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?
thanks.