class ActionDispatch::Http::UploadedFile
Attributes
content_type[RW]
headers[RW]
original_filename[RW]
tempfile[RW]
Public Class Methods
new(hash)
click to toggle source
# File lib/action_dispatch/http/upload.rb, line 6 def initialize(hash) @original_filename = encode_filename(hash[:filename]) @content_type = hash[:type] @headers = hash[:head] @tempfile = hash[:tempfile] raise(ArgumentError, ':tempfile is required') unless @tempfile end
Public Instance Methods
read(*args)
click to toggle source
# File lib/action_dispatch/http/upload.rb, line 14 def read(*args) @tempfile.read(*args) end
Private Instance Methods
encode_filename(filename)
click to toggle source
# File lib/action_dispatch/http/upload.rb, line 24 def encode_filename(filename) # Encode the filename in the utf8 encoding, unless it is nil or we're in 1.8 if "ruby".encoding_aware? && filename filename.force_encoding("UTF-8").encode! else filename end end