Return to Snippet

Revision: 33680
at October 12, 2010 04:06 by nveselinov


Initial Code
<?php
$dir = opendir(".");
while($entryName = readdir($dir)){
	$dirArray[] = $entryName;
}
closedir($dir);
$indexCount = count($dirArray);
echo $indexCount." Files<br />";
for($index=0; $index < $indexCount; $index++){
	if($dirArray[$index] != "." && $dirArray[$index] != ".."){
	$type = filetype($dirArray[$index]);
	if($type == "dir") {
	echo "<img src='img/dir.png'>";
	} else {
	echo "<img src='img/file.png'>";
	}
	echo "<a href='".$dirArray[$index]."'>".$dirArray[$index]."</a><br />";
	}
	}
?>

Initial URL

                                

Initial Description

                                

Initial Title
PHP list directory

Initial Tags
php, list, file, directory

Initial Language
PHP