hey there,
I have the following piece of PHP code to retrieve a list of files on a directory, and then build links to each file:
<?php
$dir=""; // Directory where files are stored
if ($dir_list = opendir($dir)){
while(($filename = readdir($dir_list)) !== false){
?>
<li><a href="<?php echo $filename; ?>"><?php echo $filename;
?></a></li>
<?php
}
closedir($dir_list);
}
?>
it is all nice and fine, but it builds two links too many. the first link leads to the folder where the php file resides, and the second link leads to the folder that contains the folder where the php file resides. I was wondering if there is a way, other than putting an if statement inside my while loop, to have php only generate links for the files on the directory I wish, excluding the other two links.
thanks in advance.