A
A
AleDv2016-04-04 12:58:20
Laravel
AleDv, 2016-04-04 12:58:20

Large file upload error in Laravel 5?

Hello. There is a form with the ability to upload 7 images.

{!! Form::file('image[]') !!}
{!! Form::file('image[]') !!}
{!! Form::file('image[]') !!}
 и т.д.

If you try to upload a file whose size exceeds post_max_size (in my case it is 100M, and upload_max_filesize = 10M), a TokenMismatchException exception is thrown.
When uploading images, a validator is used, which has rules for file types and their maximum sizes, but the application crashes even before the validator works.
Question: how to properly handle TokenMismatchException or prevent it altogether, for example, somehow not even try to load a file if it exceeds post_max_size ?
I would be grateful for any ideas. Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AleDv, 2016-04-04
@AleDv

The forum responded to this problem in the following way:

if you upload more then your server's post_max_size setting the input will be empty, hence a token miss-match
so if you have 2 upload input's in your form and your upload_max_filesize is 2G, your post_max_size needs to be at least 4G

But it didn't help much in solving the problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question