We're working on a form to upload some files in Laravel 4, and the upload archives we have are rather large, up to around 500MB.
I want our system to throw an Exception when the POST size exceeds the size set in post_max_size, but instead of PHP throwing an exception, we are seeing a variable set by PHP called $php_errormsg
and the application continues simply without any $_POST
data.
Is there a way to configure PHP to automatically throw an Exception for this kind of error, or would I need to write some logic checking for example for the existence of $php_errormsg etc.
I think this is a rather weird way of dealing with this kind of error differently. Why deviate from standard PHP exceptions?
Another observation I made is that the $php_errormsg variable only exists when I check for it inside index.php, at the initial application entry point, but by the time Laravel 4 reaches the controller action, there's simply no concept of anything that went wrong, $php_errormsg is missing, and there's simply no Exception thrown and because $_POST
got blanked out, we're getting validation errors for missing required fields rather than the actual:
POST Content-Length of x bytes exceeds the limit of x bytes