I’ve tried this (documentation states it is compatible w/ EE2), and found this (no EE2 version). The human filesizer is installed, but it doesn’t actually do anything. It only outputs a static 4KB, and ignores the custom file field that I have between the open and closing tags.
Has anyone had any luck with this in EE2?
I suppose I can just probably tool around with some php and write something fairly simple to convert the byte size of the linked file.. meh…. {this is so}{/much easier though}
<?php
function formatBytes($bytes, $precision = 2) {
$units = array('B', 'KB', 'MB', 'GB', 'TB');
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
$bytes /= pow(1024, $pow);
return round($bytes, $precision) . ' ' . $units[$pow];
}
?>