title: Uploading files using Skipper with Sails.js v0.10 - how to retrieve new file name
body: <p>I am upgrading to <code>Sails.js</code> version 0.10 and now need to use <a href="https://github.com/balderdashy/skipper" rel="nofollow">Skipper</a> to manage my file uploads.</p>
  
  <p>When I upload a file I generate a new name for it using a UUID, and save it in the public/files/ folder (this will change when I've got this all working but it's good for testing right now)</p>
  
  <p>I save the original name, and the uploaded name + path into a Mongo database.</p>
  
  <p>This was all quite straightforward under <code>Sails v0.9.x</code> but using <code>Skipper</code> I can't figure out how to read the new file name and path. (Obviously if I could read the name I could construct the path though so it's really only the name I need)</p>
  
  <p>My Controller looks like this</p>
  
  <pre><code>var uuid = require('node-uuid'),
      path = require('path'),
      blobAdapter = require('skipper-disk');
  
  module.exports = {
  
    upload: function(req, res) {
  
      var receiver = blobAdapter().receive({
            dirname: sails.config.appPath + "/public/files/",
            saveAs: function(file) {
              var filename = file.filename,
                  newName = uuid.v4() + path.extname(filename);
              return newName;
            }
          }),
          results = [];
  
      req.file('docs').upload(receiver, function (err, files) {
        if (err) return res.serverError(err);
        async.forEach(files, function(file, next) {
          Document.create({
            name: file.filename,
            size: file.size,
            localName: // ***** how do I get the `saveAs()` value from the uploaded file *****,
            path: // *** and likewise how do i get the path ******
          }).exec(function(err, savedFile){
            if (err) {
              next(err);
            } else {
              results.push({
                id: savedFile.id,
                url: '/files/' + savedFile.localName
              });
              next();
            }
          });
        }, function(err){
          if (err) {
            sails.log.error('caught error', err);
            return res.serverError({error: err});
          } else {
            return res.json({ files: results });
          }
        });
      });
    },
  
    _config: {}
  
  };
  </code></pre>
  
  <p>How do I do this?</p>