$size = 1024; $formattedSize = CFile::formatSize($size); echo "The file size is: " . $formattedSize;
$size = 1048576; $formattedSize = CFile::formatSize($size); echo "The file size is: " . $formattedSize;In this example, we are passing the size of the file as 1048576 bytes, which is equivalent to 1 MB. The formatSize function will convert this size into a human-readable format and return it as a string. The output of this code will be "The file size is: 1 MB". The CFile::formatSize function is a part of the Yii framework, which is a PHP-based web application development framework.