title: How to validate multipart/form-data in Express-validator using Nodejs
body: <p>A snippet of my code where i show my defined router,checking body param and checking for validation error.</p>
  
  <p><strong>My defined Post request:</strong></p>
  
  <pre><code>router.post("/addEmployee",upload.any(), function(req, res, next) {
  
    /*I used multer because body data from multipart/form-data*/
  
  var input = JSON.parse(req.body.data);
  </code></pre>
  
  <p><strong>Server validation:</strong> // validation not work because req.checkBody only get bodyData now i am using multipart/form-data (req.body.data)</p>
  
  <pre><code>req.checkBody('EMPID', "**EMPID must be Integer**").notEmpty().isNumeric();
  
  req.checkBody('PAYROLLID', "**PAYROLLID must be Integer**").notEmpty().isNumeric();
  
  
  .....
  
  ....
  </code></pre>
  
  <p><strong>Check validation error</strong></p>
  
  <pre><code>var validationError = req.validationErrors(); //check error
  
  
  // if (validationError) { //suppose get error -- throw that error
  
  
   res.json(validationError[0].msg);
  
  
   } else { //validation success
  
  
  ......strong text
  </code></pre>