title: How can I emulate a form submission with a javascript File object?
body: <p>So I have a file object created from a drag and drop into an area from desktop. Now things all dandy, until I have to upload it via Ajax to a Django backend. I would like to utilize the nice Django utils such as request.FILES, etc.</p>
  
  <p>Right now, I'm messing with some existing code here:</p>
  
  <pre><code>xhr.open("post", s.post, true);
  
              // Set appropriate headers
              xhr.setRequestHeader("content-type", "multipart/form-data");
              xhr.setRequestHeader("x-file-name", file.fileName);
              xhr.setRequestHeader("x-file-size", file.fileSize);
              xhr.setRequestHeader("x-file-type", file.
              xhr.send(file);
  </code></pre>
  
  <p>Try as I might, it doesn't seem to be emulate a form with a file input submission. Is there something that I am missing?</p>
  
  <p>Thanks!</p>