【发布时间】:2018-10-18 12:56:14
【问题描述】:
我已使用文件字段上传文件,它工作正常,但文件 URL 未保存在数据库中。
文件对象
benifitsFile
Object:filename:
"srrfnKNvcQ1zTOup.pdf"
size:878742
mimetype:"application/pdf"
我必须定义一个存储路径并添加字段类型。
var Storagepath = new keystone.Storage({
adapter: keystone.Storage.Adapters.FS,
fs: {
path: '/public/uploads',
publicPath: '/public/uploads/',
},
});
Course.add({
title: { type: String, required: true, initial: true},
headerimage: { type: Types.CloudinaryImage,label:'Header Image' },
benifitsFile: { type: Types.File, storage: Storagepath ,label:'Upload features & benifits file'},
questions: { type: Types.Relationship, ref: 'Question', index: true,many:true }
});
谢谢
【问题讨论】:
标签: node.js keystonejs