mirror of
https://github.com/prasathmani/tinyfilemanager
synced 2024-05-04 06:43:18 +02:00
Notice Error. #252
This commit is contained in:
parent
4a8bd014af
commit
bf8b715c13
|
@ -2244,9 +2244,17 @@ function fm_get_size($file)
|
|||
*/
|
||||
function fm_get_filesize($size)
|
||||
{
|
||||
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
|
||||
$power = $size > 0 ? floor(log($size, 1024)) : 0;
|
||||
return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]);
|
||||
if ($size < 1000) {
|
||||
return sprintf('%s B', $size);
|
||||
} elseif (($size / 1024) < 1000) {
|
||||
return sprintf('%s KB', round(($size / 1024), 2));
|
||||
} elseif (($size / 1024 / 1024) < 1000) {
|
||||
return sprintf('%s MB', round(($size / 1024 / 1024), 2));
|
||||
} elseif (($size / 1024 / 1024 / 1024) < 1000) {
|
||||
return sprintf('%s GB', round(($size / 1024 / 1024 / 1024), 2));
|
||||
} else {
|
||||
return sprintf('%s TB', round(($size / 1024 / 1024 / 1024 / 1024), 2));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue