title: Adding file to JSON using Blueimp jQuery File Upload plugin
body: <p>I've working on the frontend for a new type of survey question that allows users to upload an image file. Given that jQuery doesn't natively support file uploading, I'm trying to use the <a href="https://github.com/blueimp/jQuery-File-Upload" rel="nofollow">jQuery File Upload plugin</a>.</p>
  
  <p>I'm having trouble writing a custom method for getting the file via the plugin and inserting it into our standard json format. Here's how we would do it:</p>
  
  <pre><code>var url = "sendAnswer.json";
  var questionId = 11; //This is set elsewhere
  var fileValue = // Need to get the image file here
  $.post(url,{
   "data[Answer][question_id]": questionId,
   "data[Answer][value]" : fileValue
  });
  </code></pre>
  
  <p>How can I properly set the options in fileupload to match what I need to send? Basically I need to get the upload file into the data array. By default, I believe it's handled separately by the plugin.</p>