Reference

platform.upload

Uploads a file straight from the browser to the app's store, with progress and abort.
platform.upload(token, file, opts?) → { key, url }

Streams a file client-direct to storage against a token a backend method minted, so the bytes themselves never pass through a backend method. It reports progress as a fraction from 0 to 1, accepts an abort signal, and resolves with the stored key and a stable on-domain URL. The store, its access, and its upload policy are defined on the backend.

Parameters
token
string
RequiredAn upload token minted by a backend method.
file
File
RequiredThe file to upload.
opts
object
signal (AbortSignal) and onProgress (fraction 0..1).
Usage
// backend method mints a token; the browser uploads directly
const token = await api.getUploadSlot({ filename: file.name, contentType: file.type });
const { url } = await platform.upload(token, file, {
  onProgress: (f) => setProgress(f),
});