导轨 - 回形针不与阿贾克斯工作回形针、导轨、不与、工作

2023-09-10 18:24:10 作者:不是我的調調 。

我有一个应用程序工作正常使用的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文件上传。我现在只是实现这样的东西,我也跟着从这个网页教程: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.

希望这有助于

迦勒