Skip to content

UploadFieldInput

Defined in: packages/core/src/fields/upload/types.ts:10

Input configuration for an upload() field — the to parameter is required and references the target media collection slug.

TFieldMeta extends BaseFieldMeta = BaseFieldMeta

optional accept?: string

Defined in: packages/core/src/fields/upload/types.ts:52

Restrict files that can be uploaded by mimeType.

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/accept

'image/*'
'image/*, audio/mp4'
'image/webp, audio/mp3'

optional admin?: FieldAdminConfigInput

Defined in: packages/core/src/fields/baseTypes.ts:209

Admin UI configuration for this field.

BaseFieldInput.admin


optional defaultValue?: string[]

Defined in: packages/core/src/fields/upload/types.ts:44

Pre-filled value shown in the admin form when creating a new document.

BaseFieldInput.defaultValue


optional description?: string

Defined in: packages/core/src/fields/baseTypes.ts:194

Semantic description of the field. Used in three places:

  1. Helper text rendered below the field input in the admin form UI.
  2. As the Zod .meta({ description }) value for form validation.
  3. As the JSDoc comment on the generated document interface property.

To write a separate JSDoc comment, use interfaceDescription in addition.

BaseFieldInput.description


optional hasMany?: boolean

Defined in: packages/core/src/fields/upload/types.ts:40

Whether this input accepts multiple files or only one.


optional index?: string

Defined in: packages/core/src/fields/baseTypes.ts:220

Create a database index on this field. The string value becomes the index name in Convex.

slug: { type: "text", index: "by_slug", required: true }
// Generates: .index("by_slug", ["slug"])

BaseFieldInput.index


optional interfaceDescription?: string

Defined in: packages/core/src/fields/baseTypes.ts:196

The JSDoc comment on the generated document interface property

BaseFieldInput.interfaceDescription


optional label?: string

Defined in: packages/core/src/fields/baseTypes.ts:185

Display label for the field in the admin form.

BaseFieldInput.label


optional max?: number

Defined in: packages/core/src/fields/upload/types.ts:36

The max number of files allowed.


optional meta?: TFieldMeta

Defined in: packages/core/src/fields/baseTypes.ts:221

BaseFieldInput.meta


optional min?: number

Defined in: packages/core/src/fields/upload/types.ts:32

The min number of files allowed.


optional required?: boolean

Defined in: packages/core/src/fields/baseTypes.ts:202

Whether this field is required.

Default: false

BaseFieldInput.required


to: string

Defined in: packages/core/src/fields/upload/types.ts:28

The slug of the media collection that stores uploaded files for this field.

Must match a media collection defined via a storage adapter’s defineMediaCollection(). After running vex generate, this is typed as MediaCollectionSlug — a union of all media collection slugs in the project. Before generation, it falls back to string.

Config validation (in media/config.ts) also checks at runtime that the slug exists in VexConfig.mediaCollections.

upload({ to: "images", label: "Featured Image" })