From 08eb440031f388687a1e2bf93b7232cc0955664f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 10 Nov 2009 16:30:37 -0800 Subject: examples/rails: cleanup files when we're done Also show size uploaded and better output with proper line breaks --- examples/rails_app-2.3.4/app/controllers/files_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/rails_app-2.3.4/app/controllers/files_controller.rb b/examples/rails_app-2.3.4/app/controllers/files_controller.rb index 3d82107..4efc115 100644 --- a/examples/rails_app-2.3.4/app/controllers/files_controller.rb +++ b/examples/rails_app-2.3.4/app/controllers/files_controller.rb @@ -31,8 +31,12 @@ class FilesController < ApplicationController digest.update(buf) end while file.read(16384, buf) end - render :text => "params: #{Rack::Utils.escape_html(params.inspect)}.\n" \ - "sha1: #{digest.hexdigest}\n" \ + size = file.stat.size + File.unlink(file.path) + dump = Rack::Utils.escape_html(params.inspect) + render :text => "sha1: #{digest.hexdigest}
" \ + "size: #{size}
" \ + "params: #{dump}
" \ '' end -- cgit v1.2.3-24-ge0c7