title: Express 4 Multer / req.body and res.json not defined
body: <p>I'm trying to do a single image file + text fields upload with using Express 4.0 &amp; multer 1.1.0. The image file itself correctly uploads to the right destination but I'm getting errors with the text field and response:</p>
  
  <blockquote>
    <p>1) multer's req.body req.file objects are undefined if logged in console</p>
    
    <p>2) res.json (and also res.send when tested) gets the error - TypeError: res.json is not a function at Object.handle)</p>
  </blockquote>
  
  <p>multer is configured as follows using moment.js for dates, which is almost line-for-line from the multer Github documentation:</p>
  
  <pre><code>//standard express-generator server.js requires
  //passport.js implementation
  
  var multer   = require('multer');
  
  var storage = multer.diskStorage({
    destination: function(req, file, cb){
      cb(null, './public/photoUploads/' + moment().year() + moment().month());
    },
    filename: function(req, file, cb){
      cb(null, req.user._id + moment().unix());
    }
  })
  
  var upload = multer({storage:storage});
  
  require('./app/routes.js')(app, passport); //passport login routes - will eventually move app.post into this file
  
  app.post('/upload/photoData', upload.array('photo'), function(err, req, res) {
  
     var title = req.body.title;
     var description = req.body.description;
     var photoURL = req.file.filename;
  
     var jsonResponse = {
       "title": title,
       "description": description,
       "photoURL": photoURL
     }
  
     console.log(jsonResponse);
     res.json(jsonResponse);
  });
  </code></pre>
  
  <p>And here is the client-side form</p>
  
  <pre><code> &lt;form id="photo-data" method="post" action="/upload/photoData" enctype="multipart/form-data"&gt;
          &lt;div class="form-group"&gt;
              &lt;div class="modal-body"&gt;
  
                  &lt;label for="image" class="control-label"&gt;Photo upload&lt;/label&gt;
                  &lt;input type="file" class="form-control" name="photo" id="photo-main"&gt;
  
                  &lt;label for="caption" class="control-label"&gt;Title:&lt;/label&gt;
                  &lt;input type="text" class="form-control" name="title" id="photo-title"&gt;
  
                  &lt;label for="long-text" class="control-label"&gt;Further description:&lt;/label&gt;
                  &lt;input type="text" class="form-control" name="description" id="message-text"&gt;
              &lt;/div&gt;
              &lt;div class="modal-footer"&gt;
                  &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Cancel&lt;/button&gt;
                  &lt;button id="submit-photo" type="submit" class="btn btn-primary"&gt;Upload&lt;/button&gt;                   
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>What am I doing wrong?</p>