function getsize($file,$type) { $size = filesize("$file"); if($type = 'Bytes') { echo $size; } elseif($type = 'Kb') { $kbmath = 1024 * $size; echo $kbmath; } elseif($type = 'Mb') { $mbmath = 1024 * $kbmath; echo $mbmath; } }
echo getsize('somefile.php','Bytes');
Example:
[insert_php]
function getsize($file,$type)
{
$size = filesize(“$file”);
if($type = ‘Bytes’)
{
echo $size;
} elseif($type = ‘Kb’)
{
$kbmath = 1024 * $size;
echo $kbmath;
} elseif($type = ‘Mb’)
{
$mbmath = 1024 * $kbmath;
echo $mbmath;
}
}
echo getsize(getcwd() . $_SERVER[‘PHP_SELF’],’Bytes’) . ‘ Bytes’;
[/insert_php]
Last Updated on February 23, 2016