Skip to content

Instantly share code, notes, and snippets.

@runemadsen
Created May 23, 2012 18:35
Show Gist options
  • Save runemadsen/2776919 to your computer and use it in GitHub Desktop.
Save runemadsen/2776919 to your computer and use it in GitHub Desktop.
How to read an uploaded file in sinatra
post '/process' do
file = params[:fileupload][:tempfile]
json = JSON.parse(open(file).read)
# do something with your json here
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment