Posted by Anshul on 05/11/05 11:33
This script lists all files/directories in '.' directory. I wanna pass some
querystring with anchor around directories listed, so that if a user clicks
a directory-link, all the files in it are listed. How? Please help.
<?php
$directory='.';
$handle=opendir($directory);
echo realpath($directory);
echo "<hr>";
echo "<strong>Directories:</strong><br>";
while (false !== ($file = readdir($handle))) {
if(is_dir($file))
echo "<a href='file_browser.inc.php?dir=$file'>".$file."</a><br>";
}
rewinddir($handle);
echo "<br>";
echo "<strong>Files:</strong><br>";
while (false !== ($file = readdir($handle))) {
if(is_file($file))
echo $file."<br>";
}
closedir($handle);
?>
Navigation:
[Reply to this message]
|