How to save an image from URL

In my application users can upload images from the local machine. But I
also want to provide them to upload their images by telling the app the
full url to the an image on the web. How do I save the image on the
local machine from the url.

Thanks

On Dec 4, 2007 2:43 PM, Raj S. [email protected]
wrote:

In my application users can upload images from the local machine. But I
also want to provide them to upload their images by telling the app the
full url to the an image on the web. How do I save the image on the
local machine from the url.

require ‘net/http’

Net::HTTP.start( ‘static.destiney.com’ ) { |http|
resp = http.get( ‘/ror_vs_c_asm.jpg’ )
open( ‘/tmp/ror_vs_c_asm.jpg’, ‘wb’ ) { |file|
file.write(resp.body)
}
}


Greg D.
http://destiney.com/

Raj S. wrote:

In my application users can upload images from the local machine. But I
also want to provide them to upload their images by telling the app the
full url to the an image on the web. How do I save the image on the
local machine from the url.

Thanks

Hi Raj,

It delayed reply but Useful one.

Now it was available as a desktop application.

goto --> http://www.box.net/shared/m5vxqpr3r1

Regards,
P.Raveendran
http://raveendran.wordpress.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs