Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to persist file upload fields after a rails validation error

I have a form with multiple file uploads, The issue is when i am submitting the form and an validation error occurs, the file input field gets reset.

I basically wanted to persist those files inside the file input field for the complete process.

I have also gone through few links

How can I "keep" the uploaded image on a form validation error?

Please let me know what are the various options in such cases that one can follow.

like image 647
RailsEnthusiast Avatar asked Mar 28 '13 11:03

RailsEnthusiast


1 Answers

Carrierwave is a great tool for handling file uploads and can handle this for you

https://github.com/jnicklas/carrierwave#making-uploads-work-across-form-redisplays

like image 189
msaspence Avatar answered Oct 12 '22 19:10

msaspence