I\'m trying to upload an image to PingFM. Their documentation says:
media – base64 encoded media data.
I can access this image via the URL.
This will work too, it's a little cleaner
require 'base64'
Base64.encode64(open("file_path").to_a.join)
"How do you decode this back into a file?" - @user94154
require 'base64'
open('output_file_name.txt', 'w') do |f|
f << Base64.decode64( encoded_content )
end
Where encoded_content would be the previously encoded file content return value.