I have a following problem, I have HTML form that uploads a file with some extra information. But it allows to upload files that only less then 10MB. But when user tries to
As noted in the edited question $_POST and $_FILES are empty when PHP silently discards data (happens when the actual data is bigger than post_max_size). Since HTTP header and $_GET remain intact those can be used to detect the discards.
Option a)
if(intval($_SERVER['CONTENT_LENGTH'])>0 && count($_POST)===0){
throw new Exception('PHP discarded POST data because of request exceeding post_max_size.');
}
Option b)
Add a GET parameter that tells whether POST data is present.