Async file uploads with Rails 4

十年热恋 提交于 2019-12-11 22:37:26

问题


I have a form that uses rails jquery-UJS to submit asynchronously. It works fine as long as there is not a file input. When I add a file input, the form stops submitting asynchronously, and instead submits normally (full page reload).

I found out that since browsers do not support ajax files, UJS will fire the ajax:aborted:file event if a populated file input exists in the form. http://robots.thoughtbot.com/a-tour-of-rails-jquery-ujs

The proposed solution is to use remotipart. https://github.com/JangoSteve/remotipart. However this gem hasn't been touched since 2013. I believe I read somewhere that Rails 4 includes this functionality.

What is the Rails 4 convention for async file uploads?

来源:https://stackoverflow.com/questions/24681837/async-file-uploads-with-rails-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!