如何在导轨验证错误后保留文件上传字段。 [英] How to persist file upload fields after a rails validation error.

查看:126
本文介绍了如何在导轨验证错误后保留文件上传字段。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我基本上有多个文件上传的表单,问题是当我提交表单并发生验证错误时,文件输入字段被重置。我希望将这些文件保存在文件输入字段中,以完成整个过程。



我也经历了几个链接

如何保持 ;上传的图像在表单验证错误?



请让我知道在这种情况下,可以按照什么样的各种选项。

解决方案

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

这篇关于如何在导轨验证错误后保留文件上传字段。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆