On Firefox 3.6 and Chrome, using xhr.send(file) just puts the raw contents into the body of the request and it is not a true multipart/form-data upload.
Tried doing this: http://kaply.com/weblog/2010/05/20/post-multipart-form-xhr/
But, can’t really mix string with File contents during send().
Any workarounds?
xhr.sendAsBinary()is non-standard. Instead, usexhr.send(FormData), which does create amultipart/form-datarequest, allows appending files, and arbitrary form data.See http://www.html5rocks.com/en/tutorials/file/xhr2/#toc-send-formdata