PHP file upload max size is determined by 3 configuration values in php.ini, namely upload_max_filesize, post_max_size and memory_limit. You can get the maximum file size allowed in uploading by this snippet:
$max_upload = (int)(ini_get('upload_max_filesize')); $max_post = (int)(ini_get('post_max_size')); $memory_limit = (int)(ini_get('memory_limit')); $upload_mb = min($max_upload, $max_post, $memory_limit);
$upload_mb is the maximum file size allowed for upload in MB. It’s the smallest of the 3 values. Just display this value beside the file upload control so the user knows the limit before choosing the file.