Skip to content

Instantly share code, notes, and snippets.

@gideondsouza
Created May 31, 2016 04:44
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 gideondsouza/fc7e990030b17884d79efb28b74ced2e to your computer and use it in GitHub Desktop.
Save gideondsouza/fc7e990030b17884d79efb28b74ced2e to your computer and use it in GitHub Desktop.
require 'sinatra'
get "/" do
erb :form
end
post '/save_image' do
@filename = params[:file][:filename]
file = params[:file][:tempfile]
File.open("./public/#{@filename}", 'wb') do |f|
f.write(file.read)
end
erb :show_image
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment