Method: ActionDispatch::Http::UploadedFile#initialize
- Defined in:
- actionpack/lib/action_dispatch/http/upload.rb
#initialize(hash) ⇒ UploadedFile
:nodoc:
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'actionpack/lib/action_dispatch/http/upload.rb', line 31 def initialize(hash) # :nodoc: @tempfile = hash[:tempfile] raise(ArgumentError, ":tempfile is required") unless @tempfile @content_type = hash[:type] if hash[:filename] @original_filename = hash[:filename].dup begin @original_filename.encode!(Encoding::UTF_8) rescue EncodingError @original_filename.force_encoding(Encoding::UTF_8) end else @original_filename = nil end if hash[:head] @headers = hash[:head].dup begin @headers.encode!(Encoding::UTF_8) rescue EncodingError @headers.force_encoding(Encoding::UTF_8) end else @headers = nil end end |