Skip to content
KeystoneJS LogoKeystoneJS

File

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

Usage

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.
routeStringnull
isRequiredBooleanfalseDoes this field require a value?

On this page

  • Usage
  • Config
Edit on GitHub