I created a node API using multer to store files and i'm getting error while calling it, please help. Bellow is the code and error -
Code -
const storage = multer.diskStorage({
    destination: './public/upload',
    filename: function(req, file, cb){
        cb(null, file.fieldname + '-' + Date.now() + path.extname(file.originalname));
    }
});
// initialize upload
const upload = multer({
    storage: storage,
    limits: {fieldSize: 100000}
}).single('myImage');
app.post('/upload', (req, res)=> {  
    upload(req, res, (err) => {
        if(err){
            res.json({
                msg: req.body,
            });
        }else {
            res.json({
                msg: 'File uploaded',
                file: `upload/${req.file.filename}`
            });
        }
    })
})
The error i'm getting while making API call is "name": "MulterError", "message": "Unexpected field", "code": "LIMIT_UNEXPECTED_FILE", "storageErrors": []