title: Change filename when using express/multer
body: <p>I'm having trouble uploading a pdf, when I upload it (I'm using <code>ng-file-upload</code>) the file json that reachs express.js is:</p>
  
  <pre><code>{ fieldname: 'file',
    originalname: 'db.pdf',
    encoding: '7bit',
    mimetype: 'application/pdf',
    destination: './client/public/docs/transactions/',
    filename: '8a3fe7cb7369d9cffa8e17b162ec3d6b',
    path: 'client\\public\\docs\\transactions\\8a3fe7cb7369d9cffa8e17b162ec3d6b',
    size: 9179145 }
  </code></pre>
  
  <p>I'd like to change the name to a property that I send from angular to express, here's all the setup:</p>
  
  <p>html element:</p>
  
  <pre><code>&lt;div ngf-select="vm.uploadPdf($file, $errFiles)"
       ngf-pattern="'.pdf'"
       accept="application/pdf" ngf-max-size="20MB"&gt;Select ...
  &lt;/div&gt;
  </code></pre>
  
  <p>angular func <code>uploadPdf</code> (ctrl as vm):</p>
  
  <pre><code>function uploadPdf( file, errFiles ) {
      vm.pdf = file;
      vm.errorFile = errFiles &amp;&amp; errFiles[ 0 ];
  
      if ( vm.pdf ) {
          Upload
              .upload( {
                  url: '/upload',
                  data: {
                      file: vm.pdf,
                      new_file_name: vm.new_name//this is the filename I want
                  }
              } )
              .then(
                  function ( response ) {
                      $timeout( function () {
                          vm.pdf.result = response.data;
                      } );
                  }, function ( response ) {
                      if ( response.status &gt; 0 ) {
                          vm.errorQuedanPdfUpload = response.status + ': ' + response.data;
                          console.log( vm.errorQuedanPdfUpload );
                      }
                  }
              );
      }
  }
  </code></pre>
  
  <p>express:</p>
  
  <pre><code>var express = require( 'express' ),
      router  = express.Router(),
      util    = require( 'util' ),
      multer  = require( 'multer' );
  
  var storage = multer.diskStorage(
      {
          destination: './uploads/',
          filename: function ( req, file, cb ) {
              //req.body is empty...
              //How could I get the new_file_name property sent from client here?
              cb( null, file.originalname );
          }
      }
  );
  
  var upload = multer( { storage: storage } );
  
  router.route( '/upload' )
      .post( upload.single( 'file' ), post );
  
  function post( request, response ) {
  
      response.json( { message: 'Files Uploaded!' } );
  
  }
  </code></pre>