I created a function to open a directory and create a page that contains links to all files inside the directory. It gets rid of the . and .. "directories" but it keeps the spaces there. Any ideas on how to stop that? Here is the function I wrote:
function files ($path) {
$cwd = getcwd();
$open = opendir("$cwd/$path");
while (($contents = readdir($open)) !==false) {
$contents = ereg_replace ("[.]", "", $contents);
$files = split("-", "$contents");
$url = ("<a href=\"$path/$contents\" target=\"_blank\">$files[0]</a><br/>\n");
echo "$url <br/>\n";
}
closedir($open);
}
Thanks!
Chad