<p>What's probably happening on both of your cases is a PHP fatal error, which are notoriously difficult to recover from.</p>

<p>The upcoming Craft 3 (thanks to some clever tricks in Yii 2), however does handle fatal PHP error much better and in situations like yours, you would be receiving the actually underlying fatal error message.</p>

CC BY-SA 3.0
2015-01-19T20:13:45.350Z
Please see my edit above. After further testing, there are two different issues, depending on whether the file size is larger than upload_max_filesize or post_max_size. The maxUploadFileSize doesn't seem to matter, apart from overriding upload_max_filesize if it is lower.
Eli Van Zoeren
CC BY-SA 3.0
2015-01-19T19:30:55.250Z
2015-01-19T23:31:41.323Z
2015-01-19T23:31:41.323Z
Brad Bell
<p>I have a front-end entry form using the Guest Entries plugin, with a file input for the user to upload a photo. I am also using the jQuery Form plugin for AJAX submission, but the behavior is the same if I disable it. </p>

<p>The form works great with small file sizes, but if the uploaded image is larger than PHP's <code>upload_max_filesize</code>, I get a fatal error: <code>Imagine\Exception\RuntimeException: Unable to open image</code>.</p>

<p>If the uploaded file is larger than PHP's <code>post_max_size</code>, the page simply reloads - no error is registered. I gather that this error can be difficult to catch, so maybe it's impossible to have a more graceful failure in this case.</p>

<p>However, for file sizes between upload_max_filesize and post_max_size, shouldn't there be a way to return that as a proper error in the errors array, instead of dying in a way that is unhelpful to the end user?</p>

<upload><guest-entries>
Catch file-size errors in Guest Entries Form
# Catch file-size errors in Guest Entries Form

(Asked by: username_0 on 2015-01-19)

I have a front-end entry form using the Guest Entries plugin, with a file input for the user to upload a photo. I am also using the jQuery Form plugin for AJAX submission, but the behavior is the same if I disable it.

The form works great with small file sizes, but if the uploaded image is larger than PHP's `upload_max_filesize`, I get a fatal error: `Imagine\Exception\RuntimeException: Unable to open image`.

If the uploaded file is larger than PHP's `post_max_size`, the page simply reloads - no error is registered. I gather that this error can be difficult to catch, so maybe it's impossible to have a more graceful failure in this case.

However, for file sizes between upload\_max\_filesize and post\_max\_size, shouldn't there be a way to return that as a proper error in the errors array, instead of dying in a way that is unhelpful to the end user?

**Tags:** upload, guest-entries

---

## 1 answers

### Answer by username_1 on 2015-01-19. Score: 1

What's probably happening on both of your cases is a PHP fatal error, which are notoriously difficult to recover from.

The upcoming Craft 3 (thanks to some clever tricks in Yii 2), however does handle fatal PHP error much better and in situations like yours, you would be receiving the actually underlying fatal error message.

> **Comments:**
> **username_0**: Please see my edit above. After further testing, there are two different issues, depending on whether the file size is larger than upload_max_filesize or post_max_size. The maxUploadFileSize doesn't seem to matter, apart from overriding upload_max_filesize if it is lower.  

---

