$fileSize = 12345678; $formattedSize = t3lib_div::formatSize($fileSize); echo $formattedSize; // Outputs "11.77 MB"
$fileSize = 1024; $formattedSize = t3lib_div::formatSize($fileSize); echo $formattedSize; // Outputs "1 KB"In this example, we have provided the function with a file size of 1024 bytes, which is then returned as a human-readable string `"1 KB"`. In conclusion, the t3lib_div::formatSize() function can be very useful in converting file sizes into a more easily understandable format. Being part of the TYPO3 CMS package library, it is easy to integrate and use within TYPO3 projects.