class ActionDispatch::Http::UploadedFile
def encode_filename(filename)
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
def initialize(hash)
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
def read(*args)
def read(*args) @tempfile.read(*args) end