图像文件大小以Php为单位

I am trying to get the file size of an image. If I upload below a 5 MB size image, then this function is properly calculating image size. But if the image file size is exceeded then it is not calculating image file !

$size = filesize($_FILES['file']['tmp_name']);

I am not understanding what the problem is.

untested code

 if(empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post'){ //catch file overload error...
        $postMax = ini_get('post_max_size'); //grab the size limits...
        echo "<p style=\"color: #F00;\">
Please note files larger than {$postMax} will result in this error!<br>Please be advised this is not a limitation in the CMS, This is a limitation of the hosting server.
        callMyForm(); //bounce back to the just filled out form.
}
elseif(// continue on with processing of the page...