Skip to content
KeystoneJS LogoKeystoneJSv5

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

Note: adapter currently may be one of LocalFileAdapter or CloudinaryFileAdapter.

Have you found a mistake, something that is missing, or could be improved on this page? Please edit the Markdown file on GitHub and submit a PR with your changes.

Edit Page