且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在导轨验证错误后保留文件上传字段。

更新时间:2023-09-29 22:06:58

Carrierwave是一个处理文件上传的好工具, https://github.com/jnicklas/carrierwave#making-uploads-work-across-表单重新显示


I have 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.

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