title: Using XMLHttpRequest I send a file to an MVC 3 controller method. How can I get the contents of the file?
body: <p>I am doing this:</p>
  
  <pre><code> xhr.open('post', '/Fish/Create', true);
   xhr.send(file);
  </code></pre>
  
  <p>This produces a HTTP post that hits my controller method, and the contents of the file are being posted to it (as I can see in fiddler).</p>
  
  <p>How can I get the contents out of the Request object?</p>
  
  <p>For bonus points, I wonder if you can use a header or get a HttpPostedFileBase object. I can do something like <code>xhr.setRequestHeader("X-File-Name", "file");</code> and then in the controller method accept <code>object file</code> but I can't figure out what type the file is, or if it even created it correctly from stream.</p>
  
  <p>I can't use FormData because it's not supported in IE9.</p>