FormatSize
CFile::FormatSize( $size, $precision );
The method converts bytes into Kilobytes, Megabytes, Gigabytes and etc. with account of the language, installed in the current site. Static method.
Parameters
Parameter | Description |
---|---|
size | File size in bytes |
precision | Rounding procedure. By default - 2. |
Returned value
Returns file size value via text, rounded to the last complete value and text caption of size in bytes, kilobytes and etc. with account of the language, installed in the current site.
Example
<? $rsFile = CFile::GetByID($arBooktel['BOOKLET']['PREVIEW_PICTURE']); //Here's ID $arBooktel['BOOKLET']['PREVIEW_PICTURE']=$rsFile->Fetch(); $arBooktel['BOOKLET']['PREVIEW_PICTURE']['SIZE']=CFile::FormatSize($arBooktel['BOOKLET']['PREVIEW_PICTURE']['FILE_SIZE']); echo $arBooktel['BOOKLET']['PROPERTY_FILE_VALUE']['SIZE']; ?>
Result:
157.59 Kb
© «Bitrix24», 2001-2024