mirror of
https://github.com/prasathmani/tinyfilemanager.git
synced 2025-07-28 20:40:35 +02:00
Notice Error. #252
This commit is contained in:
@@ -2244,9 +2244,17 @@ function fm_get_size($file)
|
|||||||
*/
|
*/
|
||||||
function fm_get_filesize($size)
|
function fm_get_filesize($size)
|
||||||
{
|
{
|
||||||
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
|
if ($size < 1000) {
|
||||||
$power = $size > 0 ? floor(log($size, 1024)) : 0;
|
return sprintf('%s B', $size);
|
||||||
return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]);
|
} 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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user