title: Using Dropzone.js to upload after new user creation, send headers
body: <p>I'm using a great plugin - dropzone.js (dropzonejs.com) to make my site a little more fancy when registering a new user.</p>
  
  <p>Basically, the user fills out a form, drops a couple images into the "dropzone", and clicks "Submit", which fires an ajax call that posts the form to a php script.</p>
  
  <p>I have dropzone parameters set to enqueForUpload:false, which keeps the files from auto-uploading, since I need them to upload into uploads/$userid, after the new user id has been created. I can give dropzone header params, which I'm assuming post to the url, similar to an ajax call, instead of data: {'userid': userid}, dropzone uses headers: {'userid': userid}... However, dropzone gets initialized on document.ready, and as the userid variable isn't declared yet, dropzone fails to initialize.</p>
  
  <p>I'm guessing I'm going to need to initialize dropzone with document.ready, but not give it headers just yet. Then after the ajax form processing is successful and returns userid, call dropzone to upload and give it the headers at that point. Problem is, I don't know what code would need to be called to make that happen.</p>
  
  <p>Initialize Dropzone on ready:</p>
  
  <pre><code>$(document).ready(function(){
    $('#dropzone').dropzone({
      url: 'dropzoneprocess.php',
      maxFilesize: 1,
      paramName: 'photos',
      addRemoveLinks: true,
      enqueueForUpload: false,
    });
  });
  </code></pre>
  
  <p>Then...</p>
  
  <pre><code>$('#submit').on('click', function(){
      validation crap here
      $.ajax({
          type: 'post',
          url: 'postform.php',
          data: {'various': form, 'values': here}
          datatype: 'json',
          success: function(data){
             var userid = data.userid;
  
      /* (and this is what I can't figure out:)
      tell dropzone to upload, and make it 
      post userid to 'dropzone.php' */
  
       });
  });
  </code></pre>