Upload, then attach
Files are a two-step flow: upload the bytes to get a file id, then attach that id to a record field. Doing it in one step is the most common file bug.
// 1. upload
const up = await tada.files.upload(fileBytes, { name: 'contract.pdf', type: 'application/pdf' });
const fileId = up.data?.file_id;
// 2. attach to a File/Image field on the record
await tada.records.update('contracts', recordId, { field_20: [{ file_id: fileId }] }); Secure vs public files
Whether a file is protected is a property of the field, set in the Tadabase builder:
| Field setting | Behavior |
|---|---|
| Secure | Stored in a private bucket. Downloads use short-lived signed URLs (about 10 minutes) fetched per request. |
| Public | Permanent CDN link — fine for logos and public assets, wrong for anything sensitive. |
Downloading
tada.files.get(fileId) returns metadata plus a fresh download URL. For secured files, always fetch a new URL at download time rather than storing one — the old link expires.