Skip to content

Instantly share code, notes, and snippets.

@lporras
Created April 12, 2014 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lporras/10513138 to your computer and use it in GitHub Desktop.
Save lporras/10513138 to your computer and use it in GitHub Desktop.
guardar imagen
dirname = File.dirname(self.image_tmp)
path = Rails.root.join "tmp/uploads", dirname
file_with_path = Rails.root.join "tmp/uploads", self.image_tmp
FileUtils.mkdir_p(path)
File.open(file_with_path, "wb") { |f| f.write(open(URI.parse(url)).read) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment