我正在使用express-fileupload包将文件上传到minio对象存储。现在,我想将图像文件大小限制为1Mb,视频文件大小限制为10Mb。
发布于 2020-04-09 15:54:28
创建两个独立的中间件实例,为图像和视频提供不同的选项。
const videoUpload = fileUpload({
useTempFiles: true,
tempFileDir : '/tmp/',
createParentPath: true
limits: { fileSize: 50 * 1024 * 1024 },
});
const imageUpload = fileUpload({
createParentPath: true
limits: { fileSize: 1 * 1024 * 1024 },
});把他们引向不同的路线。
app.use('/upload/video', videoUpload);
app.use('/upload/image', imageUpload);https://stackoverflow.com/questions/58539398
复制相似问题