Skip to content

Instantly share code, notes, and snippets.

@zimbatm
Forked from digitalextremist/Gemfile
Last active December 16, 2015 08:19
Show Gist options
  • Save zimbatm/5405399 to your computer and use it in GitHub Desktop.
Save zimbatm/5405399 to your computer and use it in GitHub Desktop.
source "http://rubygems.org"
gem "rack", :github => 'digitalextremist/rack', :branch => 'master'
gem 'reel', :github => 'digitalextremist/reel', :branch => 'master'
gem 'celluloid'
gem 'celluloid-io', "~> 0.13.1"
#gem "octarine", :github => 'digitalextremist/octarine', :branch => 'master'
gem "sinatra", '1.3.5'
#gem "sinatra-contrib", '1.3.1'
GIT
remote: git://github.com/digitalextremist/rack.git
revision: 232ed1ee3a2620e717a603319e52aa82d687554b
branch: master
specs:
rack (1.6.0.alpha)
GIT
remote: git://github.com/digitalextremist/reel.git
revision: 0ae5bfca6f789838664f9c5e529a48bba8a8939b
branch: master
specs:
reel (0.3.0)
celluloid-io (>= 0.8.0)
http (>= 0.2.0)
http_parser.rb (>= 0.5.3)
rack (>= 1.4.0)
websocket_parser (>= 0.1.2)
GEM
remote: http://rubygems.org/
specs:
celluloid (0.13.0)
timers (>= 1.0.0)
celluloid-io (0.13.1)
celluloid (>= 0.13.0)
nio4r (>= 0.4.0)
certified (0.1.1)
http (0.4.0)
certified
http_parser.rb
http_parser.rb (0.5.3)
http_parser.rb (0.5.3-java)
nio4r (0.4.3)
nio4r (0.4.3-java)
rack-protection (1.5.0)
rack
sinatra (1.3.5)
rack (~> 1.4)
rack-protection (~> 1.3)
tilt (~> 1.3, >= 1.3.3)
tilt (1.3.7)
timers (1.1.0)
websocket_parser (0.1.2)
http
PLATFORMS
java
ruby
DEPENDENCIES
celluloid
celluloid-io (~> 0.13.1)
rack!
reel!
sinatra (= 1.3.5)
require 'rubygems'
require 'bundler/setup'
require 'fileutils'
require 'reel'
require 'sinatra'
MU_UPLOADS = File.expand_path('../uploads', __FILE__) + '/'
FileUtils.mkdir_p MU_UPLOADS
set :show_exceptions, true
set :raise_errors, true
set :server, :reel
set :bind, "0.0.0.0"
set :port, "8808"
get '/' do
content_type :html
File.open('uploader.html')
end
post "/upload" do
File.open( MU_UPLOADS + params["file"][:filename], 'w') {|f| f.write( params["file"][:tempfile].read ) }
puts "saved file // " + "uploads/" + params["file"][:filename]
redirect "/"
end
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>test-reel; multipart parsing</title>
</head>
<body>
<div id="label"><h3>multipart &amp; standard POST testing</h3></div>
<div id="form">
<form action="/upload" method="post" enctype="multipart/form-data">
<input type="file" name="file"/>
<input type="text" name="textfield" value="ipsum lorem"/><br/>
<textarea name="textarea">ipsum lorem</textarea><br/>
<input type="submit"/>
</form>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment