ActionDispatch::Http::UploadedFile (original) (raw)

Action Dispatch HTTP UploadedFile

Models uploaded files.

The actual file is accessible via the tempfile accessor, though some of its interface is available directly for convenience.

Uploaded files are temporary files whose lifespan is one request. When the object is finalized Ruby unlinks the file, so there is no need to clean them with a separate maintenance task.

Methods

C

E

O

P

R

S

T

Attributes

[RW] content_type A string with the MIME type of the file.
[RW] headers A string with the headers of the multipart request.
[RW] original_filename The basename of the file in the client.
[RW] tempfile A Tempfile object with the actual uploaded file. Note that some of its interface is available directly.

Instance Public methods

Shortcut for tempfile.close.

Source: show | on GitHub

def close(unlink_now = false) @tempfile.close(unlink_now) end

Shortcut for tempfile.eof?.

Shortcut for tempfile.open.

Shortcut for tempfile.path.

Shortcut for tempfile.read.

Source: show | on GitHub

def read(length = nil, buffer = nil) @tempfile.read(length, buffer) end

Shortcut for tempfile.rewind.

Shortcut for tempfile.size.

Shortcut for tempfile.to_path.