RAILS - paperclip don't work with Ajax

痴心易碎 提交于 2019-12-08 07:04:42

问题


i have an application working fine with form_for updloading an image using paperclip.

The problem is, because of the javascript security model, it cannot upload a picture via AJAX.

I would like to know: what is the best approach, that really works with rails 2.3.x, to send file via aJAX using rails? IFRAME technique? swfupload? Any other idea?

VP


回答1:


The iframe technique is the way to go for AJAX file uploading. I currently just implemented something like this and I followed the tutorial from this page: http://khamsouk.souvanlasy.com/articles/ajax_file_uploads_in_rails_using_attachment_fu_and_responds_to_parent

In the tutorial he uses attachment_fu but the code works just fine with paperclip.

Hope this helps,

Caleb



来源:https://stackoverflow.com/questions/1829238/rails-paperclip-dont-work-with-ajax

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