title: Uploading a file with ng-file-upload directive to a sails.js server
body: <p>I'm attempting to upload a file to a sails.js application server using this directive:
  <a href="https://github.com/danialfarid/angular-file-upload" rel="nofollow">ng-file-upload</a></p>
  
  <p>My client side to upload an already selected image is this:</p>
  
  <pre><code>$upload.upload({
          url:'upload/item-image',
          headers:{
              'Content-Type': 'multipart/form-data'
          },
          data:{blah:'blah'},
          file: $scope.uploadFile,
          fileName:$scope.uploadFile.name
      }).success(function(data){
          console.log(data);
      }).error(function(err){
          console.log(err);
      });
  </code></pre>
  
  <p>And my sails.js controller method that handles the upload on the server starts like this:</p>
  
  <pre><code>upload: function (req, res) {
      req.file('item-image').upload(function (err, files) {
          if (err)
              return res.serverError(err);
          if(!files.length)
              return res.serverError('No files received for upload.');
  
          var file = files[0];
     ...
     }
  ...
  }
  </code></pre>
  
  <p>However, while the server function is being called, and the json data on the body exists, no files are being found by req.file('no matter what put here') callback.</p>
  
  <p>Thanks in advance.</p>