title: MulterError: Unexpected field at wrappedFileFilter in Insomnia
body: <p>I'm trying to upload a picture where the user registers in the app. When I'm trying to test it in insomnia I get the following error: <strong>MulterError: Unexpected field at wrappedFileFilter</strong></p>
  <p>I've been reading online and I know this error occurs when there is a mismatch between the field name provided by the client and the field name expected by the server. However, I've been checking many times my code and the name that I give in the server and the client (Insomnia) is the same: &quot;image&quot;. Any idea what else can I try?</p>
  <p>Here is my code:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const storage = multer.diskStorage({
      destination: './client/public/img',
      filename: (req, file, cb) =&gt; {
          console.log(file)
          cb(null, file.originalname)
      }
  })
  
  const fileFilter = (req, file, cb) =&gt; {
      if(file.mimetype == "image/jpeg" || file.mimetype == "image/png") {
          cb(null, true)
      } else {
          cb(null, false)
      }
  }
  
  const upload = multer({ storage: storage, fileFilter: fileFilter, destination: './client/public/img' })</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>//sign up
  routes.post("/register", upload.single("image"), (req, res) =&gt; {
      let { user_name, email, password, password2 } = req.body;
      let { image } = req.file.filename
      let errors = []
  
      //check required inputs
      if(!user_name || !email || !password || !password2){
          errors.push({message: "Please fill all required fields"})
          res.send({message: "Please fill all required fields"})   
      }
  
      //check passwords
      if(password != password2) {
          errors.push({message: "Passwords do not match"})
          res.send({message: "Passwords do not match"})
      }
  
      if(errors.length&gt;0) {
          console.log(errors);
      } else {
          if(email) {
              db(`SELECT * FROM user WHERE email = "${email}"`)
              .then((results) =&gt; {
                  if(results.data.length&gt;0){
                      res.send("Email exists")
                  } else {
                      bcrypt.hash(password, saltRounds, (err, hash) =&gt; {
                      password = hash
                      db(`INSERT INTO user (user_name, email, password, image) VALUES ("${user_name}", "${email}", "${password}", "${image}")`)
                          .then((results) =&gt; {
                              res.send("Registration successful")
                              if(err)throw err;
                          })
                          .catch((error) =&gt; {
                              console.log(error)
                          })
                      })
                  }
              })
              .catch((error) =&gt; {
                  console.log(error)
              })
          } else {
              res.send("Enter email")
          }
      }
  })</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>Any help will be appreciated. Thanks in advance.</p>