This is almost certainly ludicrously simple!
Heres a bit of code that gets the contents of a directory and lists it as links to the filename:
<?php
$path = "h:\media";
$dh = opendir($path);
$i=1;
while (($file = readdir($dh)) !== false) {
if($file != "." && $file != "..") {
echo "$i. <a href='$file'>$file</a><br />";
$i++;
}
}
closedir($dh);
?>
What I want to do is have it so that clicking a link, instead of trying to open the file, reloads the page with $file as the new value of $path so that it can navigate directory structure except when $file isn't a directory, in which case I want it to open the file.
Any help would be appreciated!