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.
Extends
Section titled “Extends”BaseFieldInput<TFieldMeta>
Type Parameters
Section titled “Type Parameters”TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends BaseFieldMeta = BaseFieldMeta
Properties
Section titled “Properties”accept?
Section titled “accept?”
optionalaccept?: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
Examples
Section titled “Examples”'image/*''image/*, audio/mp4''image/webp, audio/mp3'admin?
Section titled “admin?”
optionaladmin?:FieldAdminConfigInput
Defined in: packages/core/src/fields/baseTypes.ts:209
Admin UI configuration for this field.
Inherited from
Section titled “Inherited from”defaultValue?
Section titled “defaultValue?”
optionaldefaultValue?:string[]
Defined in: packages/core/src/fields/upload/types.ts:44
Pre-filled value shown in the admin form when creating a new document.
Overrides
Section titled “Overrides”description?
Section titled “description?”
optionaldescription?:string
Defined in: packages/core/src/fields/baseTypes.ts:194
Semantic description of the field. Used in three places:
- Helper text rendered below the field input in the admin form UI.
- As the Zod
.meta({ description })value for form validation. - As the JSDoc comment on the generated document interface property.
To write a separate JSDoc comment, use interfaceDescription in addition.
Inherited from
Section titled “Inherited from”hasMany?
Section titled “hasMany?”
optionalhasMany?:boolean
Defined in: packages/core/src/fields/upload/types.ts:40
Whether this input accepts multiple files or only one.
index?
Section titled “index?”
optionalindex?: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.
Example
Section titled “Example”slug: { type: "text", index: "by_slug", required: true }// Generates: .index("by_slug", ["slug"])Inherited from
Section titled “Inherited from”interfaceDescription?
Section titled “interfaceDescription?”
optionalinterfaceDescription?:string
Defined in: packages/core/src/fields/baseTypes.ts:196
The JSDoc comment on the generated document interface property
Inherited from
Section titled “Inherited from”BaseFieldInput.interfaceDescription
label?
Section titled “label?”
optionallabel?:string
Defined in: packages/core/src/fields/baseTypes.ts:185
Display label for the field in the admin form.
Inherited from
Section titled “Inherited from”
optionalmax?:number
Defined in: packages/core/src/fields/upload/types.ts:36
The max number of files allowed.
optionalmeta?:TFieldMeta
Defined in: packages/core/src/fields/baseTypes.ts:221
Inherited from
Section titled “Inherited from”
optionalmin?:number
Defined in: packages/core/src/fields/upload/types.ts:32
The min number of files allowed.
required?
Section titled “required?”
optionalrequired?:boolean
Defined in: packages/core/src/fields/baseTypes.ts:202
Whether this field is required.
Default: false
Inherited from
Section titled “Inherited from”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.
Example
Section titled “Example”upload({ to: "images", label: "Featured Image" })