Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Listing the Contents of a Directory

Sun Oct 26, 2008 8:42 pm

Code:

<html>
<head>
<title>Listing the contents of a directory with readdir()</title>
</head>
<body>
<?php
$dirname
= "./";
$dh = opendir( $dirname );
while (
gettype( $file = readdir( $dh )) != boolean ){
   if (
is_dir( "$dirname/$file" ) )
       print
"(D)";
   print
"$file<br>";
}
closedir( $dh );
?>
</body>
</html>





Post a reply
  Related Posts  to : Listing the Contents of a Directory
 java code for listing folder contents from remote folder     -  
 listing tag usage     -  
 get the Contents of a ZIP File in java     -  
 HTML Table Of Contents Generator     -  
 Listing All Rows and Fields in a Table     -  
 Listing elements using list components in J2me     -  
 database contents display in table format in swing     -  
 phone directory     -  
 php Directory lister     -  
 Creating a Directory in php     -  

Topic Tags

PHP Files and I/O