Root Directory index.php:
<?php$thelist .= '<html><body bgcolor=black text=white link=yellow vlink=yellow><center><table border=1 width=800><tr><td width=75%>File Name</td><td width=18%>File Size</td><td width=7%></td></tr>';if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != "index.php") { if(!is_dir($file)) { $size = sprintf("%u", filesize($file)); $type = "B"; if($size < 0) { $size = $size * -1; } if($size >= 1024) { $size = $size / 1024; $type = "KB"; $size = number_format(round($size, 2), 2); } if($size >= 1024) { $size = $size / 1024; $type = "MB"; $size = number_format(round($size, 2), 2); } if($size >= 1024) { $size = $size / 1024; $type = "GB"; $size = number_format(round($size, 3), 3); } $thelist .= '<tr><td><a href="'.$file.'">'.$file.'</a></td><td>'.$size.'</td><td>'.$type.'</td></tr>'; } if(is_dir($file)) { $size=""; $type="DIR"; $thelist .= '<tr><td><a href="'.$file.'">'.$file.'</a></td><td>'.$size.'</td><td>'.$type.'</td></tr>'; } } } closedir($handle); }$thelist .= '</table></center></body></html>';?><P><?=$thelist?></p>
Sub-Directory index.php:
<?php$thelist .= '<html><body bgcolor=black text=white link=yellow vlink=yellow><center><table border=1 width=800><tr><td width=75%>File Name</td><td width=18%>File Size</td><td width=7%></td></tr>';if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "index.php") { if(!is_dir($file)) { $size = sprintf("%u", filesize($file)); $type = "B"; if($size < 0) { $size = $size * -1; } if($size >= 1024) { $size = $size / 1024; $type = "KB"; } if($size >= 1024) { $size = $size / 1024; $type = "MB"; } if($size >= 1024) { $size = $size / 1024; $type = "GB"; } $size = number_format(round($size, 2), 2); $thelist .= '<tr><td><a href="'.$file.'">'.$file.'</a></td><td>'.$size.'</td><td>'.$type.'</td></tr>'; } if(is_dir($file)) { $size=""; $type="DIR"; $thelist .= '<tr><td><a href="'.$file.'">'.$file.'</a></td><td>'.$size.'</td><td>'.$type.'</td></tr>'; } } } closedir($handle); }$thelist .= '</table></center></body></html>';?><P><?=$thelist?></p>
I am just posting this for anyone who is interested
I also want to know is there a limit in file size (I think it is 4GB)