PHP: Format file size units
public static function formatFileSize($fileSize) {
if ($fileSize >= 1073741824) {
$fileSize = round($fileSize / 1073741824 * 100) / 100 . " " . self::_translate()->_('ГБ');
} elseif ($fileSize >= 1048576) {
$fileSize = round($fileSize / 1048576 * 100) / 100 . " " . self::_translate()->_('МБ');
} elseif ($fileSize >= 1024) {
$fileSize = round($fileSize / 1024 * 100) / 100 . " " . self::_translate()->_('КБ');
} else {
$fileSize = $fileSize . " " . self::_translate()->_('Б');
}
return $fileSize;
}