function format_bytes($bytes, $precision = 1)
{
$units = array('B', 'KB', 'MB', 'GB', 'TB');
$power = $bytes > 0 ? (int) floor(log($bytes, 1024)) : 0;
$power = min($power, count($units) - 1);
return round($bytes / pow(1024, $power), $precision) . ' ' . $units[$power];
}