Sha256: d0e400057e7320db6b79bdb27e7dc571beb9dfe9959614b64919c7fdeed428c7
Contents?: true
Size: 810 Bytes
Versions: 6
Compression:
Stored size: 810 Bytes
Contents
$:.unshift( "../lib" ) require 'capcode' require 'capcode/render/markaby' require 'capcode/render/static' require 'fileutils' module Capcode class Index < Route '/' def get render :markaby => :index end def post FileUtils.cp( params["upfile"][:tempfile].path, File.join( static[:path], params["upfile"][:filename] ) ) render :static => params["upfile"][:filename] end end end module Capcode::Views def index html do body do h1 "Upload..." form :method => "POST", :enctype => 'multipart/form-data' do input :type => "file", :name => "upfile"; br input :type => "submit", :value => "Upload" end end end end end Capcode.run( :static => "data" ) { FileUtils.mkdir_p 'data' }
Version data entries
6 entries across 6 versions & 1 rubygems