=1024;$i++) {
$filesize = $filesize/1024;
}
$filesize = round($filesize,$round);
switch($i) {
case 0: $filesize = $filesize." Byte"; break;
case 1: $filesize = $filesize." kB"; break;
case 2: $filesize = $filesize." MB"; break;
case 3: $filesize = $filesize." GB"; break;
case 4: $filesize = $filesize." TB"; break;
default: $filesize = $size." Byte"; break;
}
return $filesize;
}
function getdirsize($dir) {
$size=0;
$handle = opendir($dir);
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if(is_dir($dir.$file)) $size = $size + getdirsize($dir.$file.'/');
else $size=$size+filesize($dir.$file);
}
}
return $size;
}
?>