how do I base encode a binary file (JPG) in ruby
- by Angela
I have a binary files which needs to be sent as a string to a third-party web-service. Turns out it requires that it needs to be base64 encoded.
In ruby I use the following:
body = body << IO.read("#{@postalcard.postalimage.path}")
body is a strong which conists of a bunch of strings as parameters.
So...how do I base64 encode it into this string?
Thanks.