Naive implementation of a file upload

This commit is contained in:
Alexey Verkhovsky 2005-01-22 18:38:16 +00:00
parent e6c32bafc6
commit aec9449771
3 changed files with 33 additions and 4 deletions

View file

@ -71,7 +71,7 @@ class ApplicationController < ActionController::Base
not @web_name.nil?
end
@@REMEMBER_NOT = ['locked', 'save']
@@REMEMBER_NOT = ['locked', 'save', 'back']
def remember_location
if @response.headers['Status'] == '200 OK'
unless @@REMEMBER_NOT.include? action_name or @request.method != :get

View file

@ -7,14 +7,24 @@ class FileController < ApplicationController
layout 'default'
def file
if have_file?
if @params['file']
# received a file
File.open(file_name) { |f| f.write(@params['file'].read }
elsif have_file?
send_file(file_path)
else
logger.debug("File not found: #{file_path}")
# to template, which is a file upload form
# go to the template, which is a file upload form
end
end
def cancel_upload
return_to_last_remembered
end
def
private
def have_file?