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);
?>
Displaying files of subdirectories
Started by
Macintosh
, Mar 26 2008 06:59 PM
1 reply to this topic
#1
Posted 26 March 2008 - 06:59 PM
#2
Posted 27 March 2008 - 01:19 AM
Listing files of a subdirectory is a very common question, and a frequently answered one as well. I don't know if you will find it having been asked on this forum, but on google, you definately will.
For example, a site you should bookmark: http://php.net/manua...addir.php#75156
For example, a site you should bookmark: http://php.net/manua...addir.php#75156
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users