Multer: Unexpected field

Im trying to create a api that accepts images for my projects, but for some reason it gives the folowing error

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>Error</title>
</head>

<body>
    <pre>MulterError: Unexpected field<br> &nbsp; &nbsp;at wrappedFileFilter (C:UsersUsuárioDesktopdicionariobackendnode_modulesmulterindex.js:40:19)<br> &nbsp; &nbsp;at Busboy.&lt;anonymous&gt; (C:UsersUsuárioDesktopdicionariobackendnode_modulesmulterlibmake-middleware.js:114:7)<br> &nbsp; &nbsp;at Busboy.emit (events.js:310:20)<br> &nbsp; &nbsp;at Busboy.emit (C:UsersUsuárioDesktopdicionariobackendnode_modulesbusboylibmain.js:38:33)<br> &nbsp; &nbsp;at PartStream.&lt;anonymous&gt; (C:UsersUsuárioDesktopdicionariobackendnode_modulesbusboylibtypesmultipart.js:213:13)<br> &nbsp; &nbsp;at PartStream.emit (events.js:310:20)<br> &nbsp; &nbsp;at HeaderParser.&lt;anonymous&gt; (C:UsersUsuárioDesktopdicionariobackendnode_modulesdicerlibDicer.js:51:16)<br> &nbsp; &nbsp;at HeaderParser.emit (events.js:310:20)<br> &nbsp; &nbsp;at HeaderParser._finish (C:UsersUsuárioDesktopdicionariobackendnode_modulesdicerlibHeaderParser.js:68:8)<br> &nbsp; &nbsp;at SBMH.&lt;anonymous&gt; (C:UsersUsuárioDesktopdicionariobackendnode_modulesdicerlibHeaderParser.js:40:12)<br> &nbsp; &nbsp;at SBMH.emit (events.js:310:20)<br> &nbsp; &nbsp;at SBMH._sbmh_feed (C:UsersUsuárioDesktopdicionariobackendnode_modulesstreamsearchlibsbmh.js:95:16)<br> &nbsp; &nbsp;at SBMH.push (C:UsersUsuárioDesktopdicionariobackendnode_modulesstreamsearchlibsbmh.js:56:14)<br> &nbsp; &nbsp;at HeaderParser.push (C:UsersUsuárioDesktopdicionariobackendnode_modulesdicerlibHeaderParser.js:46:19)<br> &nbsp; &nbsp;at Dicer._oninfo (C:UsersUsuárioDesktopdicionariobackendnode_modulesdicerlibDicer.js:197:25)<br> &nbsp; &nbsp;at SBMH.&lt;anonymous&gt; (C:UsersUsuárioDesktopdicionariobackendnode_modulesdicerlibDicer.js:127:10)</pre>
</body>

</html>

here is my code

const multer = require('multer')
const uploads = multer({dest: 'uploads/'})


router.post('/', uploads.single('ImagemSinal') ,async (req, res) => {
    console.log(req.file)
    try{
        const { title, description, tasks } = req.body

        const project =  await Project.create({title, description, user: req.userId });

       await Promise.all(tasks.map( async task => {
            const projectTask = new Task({...task, project: project._id})

           await projectTask.save()

           project.tasks.push(projectTask)
        }))

        await project.save()
        return res.send({ project })
    } catch(err) {
        console.log(err)
        return res.status(400).send({error: 'Error creating new project'})
        
       
    }
})

and thats how im doind the request in postman

enter image description here

Answer

When you send the image from Postman, you have to type ImagemSinal as keyValue for image, because you specified that in the server side.

You can also change code in the Server side and instead of uploads.single('ImagemSinal') you can type uploads.any().