Hello everyone!
I have a form with a file dialog for users to upload a resume. As part of the validation I'm using the $_FILES array to check that the resume is less than 5MB. This works no problem.
However, my issue is when someone tries to upload a file larger than post_max_size (which in the case of the development server I am working on is 8M. The form blanks out and nothing happens (the file isn't uploaded and the validation isn't reached). It's as if the user hit ctrl-F5 and reloaded the page.
When I review my error log I see the following (expected) error:
[09-Mar-2012 17:33:24] PHP Warning: POST Content-Length of 17739365 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
My question is: how can I check for this and display/handle it so it's helpful to the user? A blank form doesn't say much. I have a notice on the form for users to not upload files larger than 5MB, but we all know how much users read...
I guess I could try increasing the value for post_max_size, but is that really the best solution?
Any help or insight would be appreciated, thank you!