Reputation: 9377
Given the following javascript code (a simple upload script):
var fd = new FormData();
fd.append("file", document.getElementById('file').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("POST", 'http://localhost:22977/home/upload');
xhr.send(fd);
IE 10
and Chrome 28.x.x.x
will send the post request with the Content-Type
set as multipart/form-data
. However Firefox 21
will set it as application/json
.
Setting the Content-Type
by:
xhr.setRequestHeader("Content-Type", "multipart/form-data");
Still doesn't affect the Content-Type
when Firefox
is making the request.
How can I make Firefox
use the right Content-Type
?
EDIT
IE 10
and Chrome 28.x.x.x
request headers:
Firefox 21
request headers:
Upvotes: 0
Views: 1073
Reputation: 19890
I use Firefox to send MPE requests via FormData regularly, and was doing so without issue in 21 for some time. It has to be some plugin you have installed, I would think. Disable all Firefox extensions and try again.
Upvotes: 2