Skip to content

Instantly share code, notes, and snippets.

@burningTyger burningTyger/app.rb forked from lchanmann/app.rb
Created Jan 28, 2011

What would you like to do?
require 'rubygems'
require 'haml'
require 'sinatra'
require 'sinatra/flash'
require 'file_uploader'
enable :sessions
get '/' do
haml :index
post '/upload' do[:file]) do |path|
flash[:upload] = "#{path} is saved."
redirect '/'
@@ layout
%title File Uploader
= yield
@@ index
%h1 File Uploader
- if flash[:upload]
%div{:style => 'color:green'}= flash[:upload]
%form{:action => '/upload', :method => 'post', :enctype => 'multipart/form-data'}
%label{:for => 'file'} Select file:
%input{:type => 'file', :id => 'file', :name => 'file'}
%input{:type => 'submit', :value => 'Upload'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.