Hey.. I need some help about How can i list files with thin the subdirectories... Following code only display the directories.. i want to display subdirectory files too. I dont want to display sub directory files on the index page..in the way that on the index file it shows the list of subdirectories.. and when i click on any subdirectory, it displays the files of that subdirectory. I would appriciate any help.. <? $path = "./"; $dir_handle = @opendir($path) or die("Unable to open $path"); while ($file = readdir($dir_handle)) { if($file == "." || $file == ".." || $file == "index.php" ) continue; echo "<a href=\"$file\">$file</a><br />"; } closedir($dir_handle); ?> PHP:
$dir = "/blah/blah/"; // Open a known directory, and proceed to read its contents if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"; } closedir($dh); } } PHP: make your $dir dynamic instead of specifying your directory why not $dir = $_GET['directory']; <a href="<?=?directory=directorylieshere;?>">