Methods
Attributes
| [RW] | content_type | The content type of the "uploaded" file |
| [R] | original_filename | The filename, not including the path, of the "uploaded" file |
Public Class methods
[ show source ]
# File actionpack/lib/action_controller/test_process.rb, line 373
373: def initialize(path, content_type = Mime::TEXT, binary = false)
374: raise "#{path} file does not exist" unless File.exist?(path)
375: @content_type = content_type
376: @original_filename = path.sub(/^.*#{File::SEPARATOR}([^#{File::SEPARATOR}]+)$/) { $1 }
377: @tempfile = Tempfile.new(@original_filename)
378: @tempfile.set_encoding(Encoding::BINARY) if @tempfile.respond_to?(:set_encoding)
379: @tempfile.binmode if binary
380: FileUtils.copy_file(path, @tempfile.path)
381: end