displaying dir contents
Posted: Thu Nov 11, 2004 4:14 pm
Im trying to display a dir's contents. Which is working fine except that it is also displaying the dir structure:
example:
. <--- do not want this to display
.. <--- do not want this to display
first file
second file
etc...
How do I get rid of those first entries????
?>
Thanks in advance!
liquid
example:
. <--- do not want this to display
.. <--- do not want this to display
first file
second file
etc...
How do I get rid of those first entries????
Code: Select all
<?php
$dir = "fileupload/uploads/".$row['cname']."/";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
do{
echo "<a href="$dir$file" target="_blank">";
echo $file;
echo "</a>";
echo "<br>";
}while(($file = readdir($dh)) !== false);
closedir($dh);
}
}Code: Select all
<?php
?>Thanks in advance!
liquid