class ActionDispatch::Http::UploadedFile
clean them with a separate maintenance task.
the object is finalized Ruby unlinks the file, so there is no need to
Uploaded files are temporary files whose lifespan is one request. When
of its interface is available directly for convenience.
The actual file is accessible via the tempfile
accessor, though some
Models uploaded files.
def close(unlink_now = false)
def close(unlink_now = false) @tempfile.close(unlink_now) end
def eof?
def eof? @tempfile.eof? end
def initialize(hash) # :nodoc:
def initialize(hash) # :nodoc: @tempfile = hash[:tempfile] raise(ArgumentError, ":tempfile is required") unless @tempfile 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 @content_type = hash[:type] @headers = hash[:head] end
def open
def open @tempfile.open end
def path
def path @tempfile.path end
def read(length = nil, buffer = nil)
def read(length = nil, buffer = nil) @tempfile.read(length, buffer) end
def rewind
def rewind @tempfile.rewind end
def size
def size @tempfile.size end
def to_io
def to_io @tempfile.to_io end
def to_path
def to_path @tempfile.to_path end