Class | ActionController::TestUploadedFile |
In: |
vendor/rails/actionpack/lib/action_controller/test_process.rb
|
Parent: | Object |
path | -> | local_path |
content_type | [R] | The content type of the "uploaded" file |
original_filename | [R] | The filename, not including the path, of the "uploaded" file |
# File vendor/rails/actionpack/lib/action_controller/test_process.rb, line 338 338: def initialize(path, content_type = Mime::TEXT, binary = false) 339: raise "#{path} file does not exist" unless File.exist?(path) 340: @content_type = content_type 341: @original_filename = path.sub(/^.*#{File::SEPARATOR}([^#{File::SEPARATOR}]+)$/) { $1 } 342: @tempfile = Tempfile.new(@original_filename) 343: @tempfile.set_encoding(Encoding::BINARY) if @tempfile.respond_to?(:set_encoding) 344: @tempfile.binmode if binary 345: FileUtils.copy_file(path, @tempfile.path) 346: end