Skip to content

Backend with Tadabase

Uploading & downloading files

The upload-then-attach flow, and secure vs public files.

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.

ts
// 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 settingBehavior
SecureStored in a private bucket. Downloads use short-lived signed URLs (about 10 minutes) fetched per request.
PublicPermanent 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.

Ready to build

Skip the docs.
Just describe it.

Tadabase AI builds it, hosts it and keeps it running. Real backend, real domain, real app.

Start Building