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 → Box

Regards,
P.Raveendran