Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

22 lines (18 sloc) 0.579 kb
require 'rubygems'
require 'sinatra'
require 'mime/types'
require 'fileutils'
FileUtils.mkdir_p File.join( File.dirname(__FILE__), 'uploads' )
get '/' do
header 'Content-Type' => 'text/plain; charset=UTF-8'
Dir['uploads/*.*'].
collect { |file| '* ' + File.basename(file) + " (#{MIME::Types.type_for(file)}, #{File.size(file)} B)" }.
join("\n")
end
post '/' do
File.open( File.join(File.dirname(__FILE__), 'uploads', params[:filename]), 'w') do |file|
file << params[:raw_data]
end
puts "* '#{params[:filename]}' uploaded"
"#{params[:filename]} OK :)"
end
Jump to Line
Something went wrong with that request. Please try again.