Get file information from a given directory. Here the following example code to list the .php files in the particular folder.
Code:
$dir = $_SERVER['DOCUMENT_ROOT'].'/OpenInviter/';
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
if (eregi("\.php",$file))
{ # Look at only files with a .php extension
$string .= "$file";
$string .= "<br>";
$fileCount++;
}
}
if ($fileCount > 0) {
echo sprintf("<strong>List of Files in <br> %s</strong>
%s<strong>Total Files: %s</strong>",$filePath,$string,$fileCount);
}
Output:
List of Files in
autoupdate.php
config.php
default.php
example.php
index.php
notifier.php
openinviter.php
stats.php
Total Files: 8
No comments:
Post a Comment