• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/file.php
  • Класс: CFile
  • Вызов: CFile::FormatSize
static function FormatSize($size, $precision = 2)
{
	static $a = array("b", "Kb", "Mb", "Gb", "Tb");

	$size = (float)$size;
	$pos = 0;
	while($size >= 1024 && $pos < 4)
	{
		$size /= 1024;
		$pos++;
	}
	return round($size, $precision)." ".GetMessage("FILE_SIZE_".$a[$pos]);
}