Don't show directories script!!!
Posted: Thu Sep 04, 2003 12:59 pm
I have a script that read al the files out of the base directory, but it also reads the sub directories, that is the thing i don't want, i want only to see the files and not the sub directories. Can somebody with this code belowe.
I allready spend 2 hours searching for a selution, but it seams god is not helping today
I allready spend 2 hours searching for a selution, but it seams god is not helping today
Code: Select all
<?php
if ($handle = opendir('')) {
echo "Download Files:<br>";
/* This is the correct way to loop over the directory. */
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if (is_dir ($file != "." && $file != "..")) {
echo "<a href="$file">$file\n<br>";
}
}
closedir($handle);
}
}
?>