Skip to main content

Module uploads

Module uploads 

Source
Expand description

Local file uploads: a signed URL, a temporary directory, and the calls the browser makes.

See docs/uploads.md for the contract this implements.

Functions§

filename_is_safe
Whether a name the browser sent can name a file in the temporary directory.
finish_upload
Handles _finishUpload, which writes the temporary names into the component’s field.
is_upload_call
Whether a call is one of the upload calls, which the dispatcher handles before any action.
max_bytes
The largest file the configured rules allow, in bytes, when they declare max:<kilobytes>.
preview
The preview endpoint: serves a temporary file whose kind may be previewed.
prune
Deletes the temporary uploads older than age, and reports how many it deleted.
remove_upload
Handles _removeUpload, which deletes a temporary file and tells the browser.
signature_is_valid
Whether an upload URL was made for id and has not expired.
signed_url
The upload URL for id, valid for the configured window.
start_upload
Handles _startUpload, which answers with the URL the browser posts to.
store
The upload endpoint: stores the files a signed URL was made for.
store_with
Stores the files for config, which the route and the tests both use.
temporary_directory
The directory the temporary uploads live in, relative to the application’s private disk.
temporary_name
A temporary file name that cannot leave the directory.
temporary_path
Where that directory is on this host, which is how a file is deleted and how a preview is read.
trim
Deletes what an abandoned upload left, then the oldest files until the directory fits max_bytes.
upload_errored
Handles _uploadErrored, which tells the browser the upload failed.