protected static function calculate_byte($download_max_b)
{
$calc_opts = array(1 => 'Bytes (bytes)', 1000 => 'KB (Kilobytes)', 1000000 => 'MB (Megabytes)');
foreach ($calc_opts as $byte => $val) {
if ($download_max_b / $byte <= 999) {
return $byte;
}
}
return 1000000;
}