问题
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