PatrickBauer's avatar

Possible bug with L5 FormRequests and image validation?

Hi guys, could somebody try and confirm if the following is a bug? Simple setup: Form with a file field, new FormRequest class with image validation for the file field and a php.ini setting with a small upload_max_filesize.

As soon as you upload an image that's bigger than upload_max_filesize, I get an Exception (Serialization of Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed) from /vendor/laravel/framework/src/Illuminate/Session/Store.php in the save() method.

Could anybody confirm this? Thank you

0 likes
6 replies
xingfucoder's avatar

Hi @PatrickBauer, did you specify the post_max_size value? I think you maybe need to specify it too in the php.ini file.

Hope it helps you.

PatrickBauer's avatar

Yep, thats set too. It all works fine when upload_max_filesize is big enough to hold the file. I just wondered what happens if you upload files that are too big and, like I wrote before, it ends in an exception :)

PatrickBauer's avatar

Normally its big enough. To test this I set it to 1M and tried uploading a 2MB image file, hoping laravel would just generate a normal validator message. Like I said, with a bigger ini-value, everything works fine (as long as I don't exceed it with a bigger file (eg. > 50MB while having upload_max_filesize at 50M))

PatrickBauer's avatar

Thanks, but no, I found that (and other links) myself. This is a pure laravel thing. I didn't change any of the internal code (and can't like in your link, just add an interface ;))

Please or to participate in this conversation.