开发者

RAILS - paperclip don't work with Ajax

开发者 https://www.devze.com 2022-12-13 03:54 出处:网络
i have an application working fine with form_for updloading an image using paperclip. The problem is, because of the javascript security model, it开发者_JS百科 cannot upload a picture via AJAX.

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

The problem is, because of the javascript security model, it开发者_JS百科 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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消