class

Kemal::FileUpload

Inherits Reference < Object

A file part of a multipart/form-data request, spooled to a temporary file that is removed when the request is over.

Read it with open, or hand path to whatever stores it:

upload = env.params.files["image"]
upload.open { |file| IO.copy(file, destination) }
File.copy(upload.path, "public/uploads/#{upload.filename}")

Constructors

new(upload)
Source

Instance methods

cleanup
Source
creation_time
Source
filename
Source
headers
Source
modification_time
Source
open

Opens the upload for reading, yields the file and closes it.

Source
path

Path of the temporary file holding the upload.

Source
read_time
Source
size

Bytes written to disk - not what the part's Content-Disposition claimed.

Source
tempfile

The upload as an open File, positioned at its start, kept open until the request is over. A handle per upload is what the default ulimit runs out of a few concurrent requests in; open closes when it is done, and path needs no handle at all.

Source