Skip to content
KeystoneJS LogoKeystoneJS
👋🏻 Keystone 5 has officially moved to maintenance only. For the latest release of Keystone please visit the Keystone website.

File

Support files hosted in a range of different contexts, e.g. in the local filesystem, or on a cloud based file server.

Usage

JS
const { File } = require('@keystonejs/fields');
const { LocalFileAdapter } = require('@keystonejs/file-adapters');

const fileAdapter = new LocalFileAdapter({
  /*...config */
});

keystone.createList('Applicant', {
  fields: {
    file: {
      type: File,
      adapter: fileAdapter,
      isRequired: true,
    },
  },
});

Config

OptionTypeDefaultDescription
adapterObjectRequiredSee the File Adapters page for available adapters.
isRequiredBooleanfalseDoes this field require a value?

On this page

  • Usage
  • Config
Edit on GitHub