图像未保存到上传文件夹节点multer

时间:2018-04-08 18:35:29

标签: node.js mongodb multer

将上传图片的路径指定为./uploads后,我的图片仍然朝向tmp文件夹。

folder tree

enter image description here

我的multer配置

const multer = require("multer");
const storage = multer.diskStorage({
    desitnation: function(req, file, cb){
        cb(null, './uploads/');
    },
    filename: function(req, file, cb){
        cb(null, file.originalname);
    }
})
const upload = multer({storage: storage});

1 个答案:

答案 0 :(得分:0)

似乎拼写错误desitnation拼写错误。它应该是destination