PHP Get Filesize
Here is an easy to use function to determine the file size of any file in PHP. Just include this function on a page..
function filesize($bytes) { $size = $bytes / 1024; if($size < 1024) { $size = number_format($size, 2); $size .= ' KB'; } else { if($size / 1024 < 1024) { $size = number_format($size / 1024, 2); $size .= ' MB'; } else if ($size / 1024 / 1024 < 1024) { $size = number_format($size / 1024 / 1024, 2); $size .= ' GB'; } } return $size; }
To get the filesize just apply the function:
filesize('filename.mp3');
