I have a gate containing FileUploadField and some more text fields. When a required field is missing, the validation fails. Then the file that I chose to upload becomes empty, so I have to select it again before submitting the form with all the fields filled in.
In fact, the FileUploadField documentation says:
The model of this component is reset with a zero value at the end of the request, because FileUpload instances are not saved in all requests, because the input streams to which they point will be closed. Because of this, the FileUpload instance must be processed in the same request as the form containing it.
Is there a way to save the selected file if the form validation fails?
source share