title: Multer and Express/Node File Upload
body: <p>req.files is producing null and now req.body is also blank. I've searched through all the answers here and can't find much.  Unfortunately, the multer documentation was pretty lacking, so hopefully someone has gone through what I am right now and knows what is happening.</p>
  
  <p>My router.js file is this:</p>
  
  <pre><code>var express = require('express');
  var request = require('request');
  var mid = require('../middleware');
  var busboy = require('connect-busboy');
  var fs = require('fs');
  var multer = require('multer');
  var upload = multer({dest: '../public/images/blog'});
  var User = require('../data/models/user');
  var router = express.Router();
  ...
  ...
  ...
  ...
  /* POST saveblog router. */
  router.post('/saveBlog', upload.any(),function(req, res, next) {
    console.log(req.body, 'Body'); 
    console.log(req.files, 'files');
    var title = req.body.titleInput;
    var body = req.body.bodyInput;
    request.post('http://' +req.headers.host + '/api/blog', {json: {body: body, title: title, userId: req.session.userId}},
    function(err, httpResponse, body) {
      if (err) {
        console.error('error posting blog');
      }
      console.log('Blog Post successfully uploaded');
    });
    return res.redirect('/blog');
  }); 
  
  module.exports = router;
  </code></pre>
  
  <p>So I'm not totally sure what's wrong with that, I originally had it as upload.single('image') but that didn't work either so who knows.  </p>
  
  <p>Here is my jade form to be submitted, if anyone can help but doesn't like jade I'm sure I can find a quick converter for it. </p>
  
  <pre><code>form(action='saveBlog', enctype='multipart/form-data', method='post')
    h1 New Blog Post 
    fieldset(data-role='')
      label(for='title') Title 
      input(id='titleInput', name='titleInput', type='text', value='', placeholder='Your Title', require='true').form-control
      label(for='image') Your Title Image
      input(id='image',name='image', type='file', accept='image/*')
      br
      label(for='body') Your Article (Box is resizable)
      textarea(id='mytextarea', name='bodyInput').form-control
      input(type='submit', value='Post your Article').btn.btn-primary
  </code></pre>