如何修复“ TypeError:req.pipe不是multerMiddleware的功能(/usr/share/kibana/plugins/.../”

时间:2019-09-05 14:29:20

标签: node.js kibana multer kibana-6

我正在通过kibana 6.7插件发送包含表单数据(multipart / form-data)的文件,并尝试使用multer保存。

 const storage = multer.diskStorage({
    destination: function (request, file, cb) {
        cb(null, './')
    },
    filename: function (req, file, cb) {
        cb(null, file.fieldname + '-' + '4')
    }
})

const upload = multer({storage: storage}).single('pr_video'); 
server.route({
        path: '/api/pr/upload',
        method: 'POST',
        handler: function (request, response) {
            upload(request, response, (err) => {
                console.log(err)
            });
            return {};
        }
    });

文件应保存在给定的位置,但出现错误TypeError: req.pipe is not a function at multerMiddleware (/usr/share/kibana/plugins/../node_modules/multer/lib/make-middleware.js:176:9

0 个答案:

没有答案