Showing filesize human readable way

function getsize($filesizebytes)
{
if($filesizebytes < 1024)
{
return $filesizebytes.”Bytes”;
}
if($filesizebytes > 1024)
{
$filekb=$filesizebytes/1024;
if($filekb < 1024)
{
$flieinkb = round($filekb,2);
return $flieinkb.”KB”;
}
if($filekb > 1024)
{
$filemb = $filekb/1024;
$fileinmb = round($filemb,2);
return $fileinmb.”MB”;
}
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: