# download picture def downloadpicture require 'net/http' require 'uri' uri = @a_urlpicturename begin uri_parse = URI.parse(uri) host = uri_parse.host path = uri_parse.path response = nil http = Net::HTTP.start(host) response = http.get(path) data = response.body File.open("/tmp/test.jpg", "w") { |f| f.write(data) } @listpicturesfromtmp = "picture downloaded" rescue @listpicturesfromtmp = "error retrieving #{uri}:" end end