> We have https://www.php.net/manual/en/features.file-upload.errors.php but in general this is not so easy to make more convenient because this runs before your PHP code starts to run, so it is not like you can stick it in a try/catch.
Hi Rasmus, These errors are only relevant when you have something in $_FILES, which is not always the case I'm afraid: - when exceeding post_max_size, $_FILES is empty - when exceeding max_file_uploads, you don't get entries in $_FILES past the nth allowed file I understand that because all of this happens before userland code is run, indeed it's not possible to catch it. I also understand that throwing a fatal error in this case would not be welcome, as it does not give userland code a chance to inform the user about the problem. What about setting a $_SERVER value in this case? For example: $_SERVER['CONFIG_LIMIT_EXCEEDED'] = 'post_max_size' This, together with empty $_POST and $_FILES if any limit is exceeded (including max_file_uploads), should be relatively sane behaviour IMO. — Benjamin