Mega Code Archive
File size with label
= 1024) { //divide the filesize (in bytes) with 1024 to get "bigger" bytes
$size = $size/1024;
$i++;
}
if ($i > 1) {
// you can change this number if you like (for more precision)
return round($size,1)." ".$bytes[$i];
} else {
return round($size,0)." ".$bytes[$i];
}
}
// example for using
echo file_size("example.txt", "myFolder");
?>