Your code is PUT'ing the body of an entire form to CouchDB. I suspect if you look at the attachment, you'll find that not just the Content-Type is incorrect. Something like this should work better:
function uploadFile() {
var file = document.getElementById('fileToUpload').files[0];
var xhr = new XMLHttpRequest();
xhr.upload.addEventListener("progress", uploadProgress, false);
xhr.addEventListener("load", uploadComplete, false);
xhr.addEventListener("error", uploadFailed, false);
xhr.addEventListener("abort", uploadCanceled, false);
xhr.open("PUT", "http://usr:pswd@localhost:5984/db_test/testdoc7/"+ file.name +"?rev=1-967a00dff5e02add41819138abb3284d");
xhr.send(file);
}
This works because the File interface inherits from Blob, so the XHR2 send algorithm will submit the file's raw data as well as setting the mime type based on the your file entry's .type attribute.
Note that at least some browsers do not provide a good MIME type guess for files, so you may still end up with "application/octet-stream" as the type unless you provide an override for yourself via xhr.setRequestHeader().