2021年3月26日星期五

Cannot read property 'buffer' of undefined cloudinary

I am having this error

TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer. Received an instance of Object

but I dont know how to solve it:

Here is my code base:

router.post('/upload/image', fileUpload.single('file'), function (req, res, next) {    let streamUpload = (req) => {      return new Promise((resolve, reject) => {        let stream = cloudinary.uploader.upload_stream(          (error, result) => {            if (result) {              resolve(result);            } else {              reject(error);            }          }        );        console.log("Images ", req.files);          streamifier.createReadStream(req.files.buffer).pipe(stream);      }).        catch(error => { throw error; });    };        async function upload(req) {        let result = await streamUpload(req);        console.log(result);    }        upload(req);  });  

Thank you anyone who help me solve this problem

https://stackoverflow.com/questions/66827345/cannot-read-property-buffer-of-undefined-cloudinary March 27, 2021 at 09:58AM

没有评论:

发表评论