I\'m using a form in Laravel 5.1 to post some text and to upload a file. It looks like this (simplified version):
{!! Form::open(array(\'url\' => \'foo/ba
There seems to be a lot of questions around for the same issue (Form::file: How to repopulate with Input::old After Validation Errors and/or on Update?) and everyone with apparent knowledge says that is not possible.
I would proppose a workaround that covers the following goals:
The keyword of it all is AJAX. I would do the following:
December 2017 update: Send all fields and attached files by a single AJAX POST
This way you avoid to have files in any temporal state in your server.
A more complex but improved version of this process, if you are worried about used bandwidth and you expect having errors in your input fields will be very common, you may do two (or more) AJAX POST validations: The first one with the input fields only, and if it's ok, send all fields (input fields again, now including the attached files) to attempt validation again and do actions with all data in case of success.