Skip to content

Instantly share code, notes, and snippets.

@chukitow
Created April 23, 2014 04:46
Show Gist options
  • Select an option

  • Save chukitow/11202981 to your computer and use it in GitHub Desktop.

Select an option

Save chukitow/11202981 to your computer and use it in GitHub Desktop.
@picture = params[:picture] #form data
directory = "photos" #path destination
path = File.join(directory,@picture.original_filename) #join the name "pathdestination/filename.extension"
File.open(path, "wb") { |f| f.write(@picture.read) } #save the file
redirect_to root_path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment