
Display directory content using PHP
function printFiles($path,$level) { if (is_dir($path)) { if ($dh = opendir($path)) { $spaces = str_repeat( ' ',($level*10));//spaces indent while (($file = readdir($dh)) !== false) { $Filename=$path.$file; $pos=strpos($file, "."); if ($pos!=0||$pos===false) {//no hidden files if (is_dir($Filename)) {//directory echo $spaces."<b>". $file."</b><br/>"; printFiles($Filename."/",$level+1);//recursive! } else { echo "$spaces<a href='$file'>".$file."</a><br/>";//normal files } } } closedir($dh); echo "<br>"; } } } printFiles($_SERVER["DOCUMENT_ROOT"]."/temp_folder/",0);//start!
How is this possible? And also how can I modify this code to display the file size?
-
imarketstuff -
[ 1 ] Thanks
SignatureI MARKET STUFF{{ DiscussionBoard.errors[1936416].message }} -