From: Aaron Worsham Date: 2006-06-04T22:00:51+09:00 Subject: Re: Writing encoded images to a file Ross Bamford wrote: > On Sun, 2006-06-04 at 21:25 +0900, Aaron Worsham wrote: >> str = 'AaBbCc' >> file = File.new("/test.gif", "w") >> file.syswrite(Base64.decode64(str)) > > Assuming you're on Windows, you'll probably want "wb" rather than just > "w" for the file mode. Also, I'd do this: > > File.open("/test.gif", "wb") do |file| > file << Base64.decode64(str) > end > > to make sure the file gets closed. That worked. Thank you very much. -- Posted via http://www.ruby-forum.com/.