Created
September 19, 2012 11:03
-
-
Save buk/3749058 to your computer and use it in GitHub Desktop.
Hier geschieht der eigentliche upload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
set :public_folder, 'public' | |
get '/' do | |
haml :index | |
end | |
post '/upload' do | |
File.open('public/uploads/' + params['file'][:filename], "w") do |f| | |
f.write(params['file'][:tempfile].read) | |
end | |
@files = [] | |
Dir.glob("public/uploads/*").each do |file| | |
@files << File.open(file, "r") | |
end | |
haml :upload | |
end | |
helpers do | |
def to_mb(value) | |
value/1024/1024 | |
end | |
end |
ganz genau! :)
Nur speicher die Informationen auch im Model
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ich muesste der Zeile 10 mein :customer_dir uebergeben, um das zu strukturieren?