简体   繁体   English

RAILS - paperclip不能与Ajax一起使用

[英]RAILS - paperclip don't work with Ajax

i have an application working fine with form_for updloading an image using paperclip. 我有一个应用程序正常使用form_for使用paperclip上传图像。

The problem is, because of the javascript security model, it cannot upload a picture via AJAX. 问题是,由于javascript安全模型,它无法通过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? 我想知道:什么是最适合rails 2.3.x的方法,通过aJAX使用rails发送文件? IFRAME technique? IFRAME技术? swfupload? SWFUpload的? Any other idea? 还有其他想法吗?

VP VP

The iframe technique is the way to go for AJAX file uploading. iframe技术是AJAX文件上传的方法。 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 我目前刚刚实现了这样的东西,我按照本页的教程: 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. 在本教程中,他使用attachment_fu,但代码在回形针上运行得很好。

Hope this helps, 希望这可以帮助,

Caleb 迦勒

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM