Here's a little function I use.
// 'human readable' filesize conversion
function byte_format($input, $dec=0) {
if ($input == 0) return " ";
$abbrev = array(" B", " KB", " MB", " GB", " TB");
$i=0;
while ($input > 1024) {
$input /= 1024;
$i++;
}
return round($input, $dec) . $abbrev[$i];
}
Edit: Technically, 1,024 bytes is a kilobyte, not 1,000 bytes. Same thing goes for megabytes, gigabytes, terabytes, pedabytes, etc.