问题
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