Files
Most real apps need people to attach something: a photo of the broken part, a signed PDF, a profile picture. Uploads are built in, private to the person who made them, and stored with the rest of your app's data.
When to use it
- An
imagefield: a picture shown in the app (profile photo, product shot). - An
attachmentfield: a document people upload (contract, receipt, CV).
Step by step
- Add an
imageorattachmentfield to the table. - Generated forms already show an upload button for it.
- In your own screen, call
app.upload(file)and store the returnedurlin the field.
Code
{ "name": "instructor", "fields": [
{ "name": "name", "type": "text" },
{ "name": "photo", "type": "image", "optional": true }
] }async function onPick(e: React.ChangeEvent<HTMLInputElement>) {
const file = e.target.files?.[0];
if (!file || !app) return;
try {
const { url } = await app.upload(file);
await app.update("instructor", id, { photo: url });
} catch (err) {
setError(err instanceof Error ? err.message : "Upload failed");
}
}
<label>Photo <input type="file" accept="image/*" onChange={onPick} /></label>Where files live
- On Appbricx Cloud, in the platform's object store. Self-hosted, on local disk or any S3-compatible bucket.
- File records live in your app's database, so backups cover them.
- Uploads are listed under Backend, Logs, Files.
Gotchas
- Private by default. Asking for someone else's file answers "not found", checked in the database before storage is touched.
- Up to 25 MB each by default. Images, PDFs, text, audio, video, JSON, ZIP and Office files.
- Seed
attachmentfields as null and make them optional; seedimagefields with a short photo description. - An offline preview can't store files.
app.uploadrejects there; show the message.