title: Meteor autoform, async callback in before hook
body: <p>I am using Autoform and Slingshot for my S3 interaction. When the user submits the form, i want to intercept the process, upload the file to S3 through Slingshot, extend the <code>doc</code> object with the returned <code>downloadUrl</code> and then at that point, return the new updated doc, and continue the autoform process</p>
  
  <p>I have the following code:</p>
  
  <pre><code>{{#autoForm collection="Tabs" id="newTabForm" type="method" meteormethod="createTab"}}
  
     ...
      &lt;div class="modal-body"&gt;
        &lt;fieldset&gt;
           {{&gt; afFormGroup name='downloadUrl' type='file' class='file-bag'}}
      ...
  
  AutoForm.hooks({
    newTabForm: {
      before: {
        insert: function(doc, template) {
          console.log(doc);
          var file     = $('.file-bag')[0].files[0];
  
          var self = this;
          uploader.send(file, function(error, downloadUrl) {
            if (error) { throw new Meteor.Error(error); }
  
            doc = _.extend(doc, { downloadUrl: downloadUrl });
            self.result(doc);
          });
        }
      },
   ....
  
  Meteor.methods({
  createTab: function(doc) {
    check(doc, TabSchema);
  
    var priceInCents = doc.price * 100;
    var extraTabAttributes = {
      userId: Meteor.userId(),
      price: priceInCents
    };
  
    _.extend(doc, extraTabAttributes);
    Tabs.insert(doc, function(error, result) {
      if (error) { return error; }
    });
  }
  </code></pre>
  
  <p>Which correctly stores url (however looks weird, C://fakepath/filename..) on the document, but fails to upload it to the S3 server</p>
  
  <p>Also side question, why doesnt the <code>console.log(doc);</code> in the before hooks log anything to the client/server?</p>