title: Node.js, multer and req.body empty
body: <p>Here it is my problem, I have a form where I can insert a file and a field but I receive only the file and not the parameter <code>test</code>! Why?</p>
  
  <p>This is my code:</p>
  
  <p>app.js:</p>
  
  <pre><code>var express = require('express');
  var bodyParser = require('body-parser');
  var app = express();
  var port = 8000;
  var multer = require('multer'); // v1.0.5
  var storage =   multer.diskStorage({
    destination: function (req, file, callback) {
      callback(null, './uploads');
    },
    filename: function (req, file, callback) {
      callback(null, file.originalname.substring(0,file.originalname.lastIndexOf('.')) + '-' + Date.now() + file.originalname.substring(file.originalname.lastIndexOf('.'),file.originalname.length));
    }
  });
  var upload = multer({ storage : storage}).single('fileUpload');
  
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({extended: true}));
  
  app.post('/api/upload',function(req,res){
      console.log(req.body);
      upload(req,res,function(err) {
          if(err) {
              return res.end("Error uploading file.");
          }
          res.end("File is uploaded");
      });
  });
  
  app.listen(port, function () {
      console.log('Express server inizializzato sulla porta ' + port);
  });
  </code></pre>
  
  <p>index.html:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Test upload&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form name="form" action="http://localhost:8000/api/upload" method="post" enctype="multipart/form-data"&gt;
              &lt;input type="text" name="test" /&gt;
              &lt;input type="file" name="fileUpload" /&gt;
              &lt;input type="submit" value="invia" /&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Someone can help me?</p>