private function formatBytes($bytes, $useStandard = true)
{
$unit = $useStandard ? 1024 : 1000;
if ($bytes <= $unit) {
return $bytes . " B";
}
$exp = intval(log($bytes) / log($unit));
$pre = $useStandard ? "kMGTPE" : "KMGTPE";
$pre = $pre[$exp - 1] . ($useStandard ? "" : "i");
return sprintf("%.1f %sB", $bytes / pow($unit, $exp), $pre);
}