Is it possible in PHP to detect when an upload failed because of filesize. I know about upload_max_filesize and post_max_size and set them to what i want but if a user doesn’t see my file size limit (which is displayed in red) and uploads a large file it doesn’t display an error. just takes a really long time.
I have <input type="hidden" name="MAX_FILE_SIZE" value="20000000" /> which i thought told the browser to check before sending but i guess not. (on firefox at least)
You can check upload_max_fillesize by $_FILES[‘file’][‘error’], but only if post_max_size is not triggered. In second situation, you can mark some way that there was a try to send a file, for example by adding parameter to action of your form like &filesended=1. And if you see that filesended is set, but $_POST global array is empty, that means user reached a post size limit.