Skip to main content
File fields store a fileId string. This page covers the full lifecycle: uploading a file and retrieving a download URL.

requestFileUpload(options, signal?)

Requests a presigned upload URL.

Upload the File

After receiving the presigned URL, PUT the file bytes directly to storage. The file never passes through your app’s server.

Save the fileId on the Record

After the upload completes, store the fileId in the record:

Complete Example

If the presigned URL expires before the upload completes, call requestFileUpload again to obtain a fresh URL and retry the PUT.

getFileUrl(fileId, signal?)

Returns a presigned download URL for a file attachment.
Opening the file in a new tab:
Triggering a download:
The presigned URL is valid for ~1 hour. Do not cache it long-term — call getFileUrl again if you need a fresh URL.

Limits

Attempting to upload a file that exceeds the storage quota throws ErrorCode.StorageLimitReached.