From: Sean O'Halpin Date: 2006-06-18T02:07:13+09:00 Subject: Re: Downloading Image On 6/17/06, Doug Bromley wrote: > Hello again > > As an extension on my previous image problem I can't even successfully > download images from a URL location. I though tthe following simple GET > request along with writing the result to a file would work but it mangles > the image and makes it unreadable. > > Net::HTTP.start("www.example.com") do |http| > resp = http.get("/images/logo.gif") > outfile = open("C:/logo.gif", "w") > outfile.write(resp.body) > outfile.close > end > > Have I done something wrong here? Can anyone see what I'm doing wrong? > As you're running on Windows, you need to open the file in binary mode, ie. open("C:/logo.gif", "wb"). Regards, Sean