Nhảy tới nội dung

File

Lưu ý sau khi phiên bản KeystoneJS 5 chuyển sang chế độ duy trì để ra mắt phiên bản mới hơn. Chúng tôi đã dựa trên mã nguồn cũ này để phát triển một phiên bản khác với một số tính năng theo hướng microservices.

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("@ocopjs/fields");
const { LocalFileAdapter } = require("@ocopjs/file-adapters");

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

ocop.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?