导轨 - 回形针不与阿贾克斯工作 [英] RAILS - paperclip don't work with Ajax

查看:118
本文介绍了导轨 - 回形针不与阿贾克斯工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序工作正常使用的form_for使用回形针updloading图像。

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

问题是因为的JavaScript安全模型,它不能通过AJAX上传图片

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

我想知道:什么是最好的方法,真正使用Rails 2.3.x工作,通过AJAX使用Rails发送文件? IFRAME技术? SWFUpload的?任何其他的想法?

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

推荐答案

iframe的技术是路要走AJAX文件上传。我现在只是实现这样的东西,我也跟着从这个网页教程:<一href="http://khamsouk.souvanlasy.com/articles/ajax%5Ffile%5Fuploads%5Fin%5Frails%5Fusing%5Fattachment%5Ffu%5Fand%5Fresponds%5Fto%5Fparent" rel="nofollow">http://khamsouk.souvanlasy.com/articles/ajax_file_uploads_in_rails_using_attachment_fu_and_responds_to_parent

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

在本教程中,他使用attachment_fu但code的作品就好用曲别针。

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

希望这有助于

迦勒

这篇关于导轨 - 回形针不与阿贾克斯工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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