Skip to main content
The Upload field selects a record from a file collection and displays its preview in the admin panel. Use it for featured images, downloadable documents, audio, video, or other assets. FrogBot adds no file collection, so declare one first. The smallest configuration marks a files collection with file: true:
Then point an Upload field at it:

Config options

Admin options

Upload fields support the standard field admin options, plus these options:

Custom file collection

To use a slug other than files, mark one collection with file: true. FrogBot enables its required upload behavior while preserving your fields and settings:
Mark exactly one collection with file: true. FrogBot merges its required upload configuration into that collection. Without a marked collection, FrogBot adds none, and an Upload field whose relationTo names a missing collection stops startup. Do not use upload: true to select the FrogBot file collection. If the marked collection also sets upload: false, configuration fails.

Filtering upload options

Use filterOptions to limit files in the selector and validate submitted relationships. It accepts a query constraint, or a callback that returns a constraint, true to allow every record, or false to allow none. The callback receives: For example, limit the default file collection to images:

Bidirectional relationships

An Upload field stores the connection on the record containing it. The file record does not automatically list every record that uses it. Add a Join field to the file collection when editors or API consumers need to traverse the relationship in both directions.

Polymorphic uploads

The underlying field shape accepts an array in relationTo, but every target must be an active file collection. FrogBot has exactly one file collection, so polymorphic Upload fields are not supported. Use separate Upload fields when records need distinct asset roles. Use hasMany to select multiple records from the active file collection:
For a custom file collection, replace files with the slug of the collection marked file: true.

Custom components

Override the field through admin.components. A custom component can wrap FrogBot’s default upload control:

Server component

Client component