Forum Moderators: coopster
can anyone help me out and tell me why it isnt actually showing the files.. gifs, jpegs etc?
//heres the code
<?
$the_array = Array();
$handle = opendir('/home/www/juttuffi/midi');
while (false!== ($file = readdir($handle))) {
if ($file!= "." && $file!= "..") {
$the_array[] = $file;
}
}
closedir($handle);
sort ($the_array);
reset ($the_array);
while (list ($key, $val) = each ($the_array)) {
echo "<a href=show.php?id=$val target=_blank>$val</a><br>";
}
?>
The reason you keep getting the the same listing is because you keep calling the same script,
show.php, which is designed to give the directory listing at the beginning of the script in your
opendirfunction.
If you want to show the actual file, drop the
show.phpfrom your href and give it the actual (http) path to the file.