开发者

How to submit multipart messages using ActiveResource?

开发者 https://www.devze.com 2022-12-25 04:42 出处:网络
I am trying send user profile images from a client to the server using ActiveResource. It looks like Active开发者_运维技巧Resource doesn\'t support multi-part.

I am trying send user profile images from a client to the server using ActiveResource. It looks like Active开发者_运维技巧Resource doesn't support multi-part.

Is there a gem/plugin that adds Multipart support to ActiveResource? Or any other alternative approach to addressing this issue.


The best way is not to use multipart, but to embed the file's binary content in your resource's XML, which then goes in the request body.

This is easy to do using ActiveResource

I've created a plugin to do that in Rails 3:

http://github.com/nragaz/encoded_attachment

0

精彩评论

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

关注公众号