While Chrome, Firefox, Safari working fine, IE 11 fails the following ajax file upload. On IE 11, it tried to upload the image however takes 30+ senonds and finally dies leaving no clue.
My Form
<form action="/upload" method="post" enctype="multipart/form-data">
<label>Your name</label>
<input name="uname" type="text" id="uname">
<label>File1</label>
<input name="file[]" type="file" id="file1" accept="image/*">
<label>File2</label>
<input name="file[]" type="file" id="file2" accept="image/*">
<button id="btn-submit" type="submit">Submit</button>
</form>
The JS
$('#btn-submit').click(function(e) {
var formData = new FormData($('form')[0]);
$.ajax({
url: '/upload',
type: 'POST',
data: formData,
cache: false,
contentType: false,
processData: false,
success: function() {
console.log(arguments);
},
error: function() {
console.error(arguments);
}
});
});
My NodeJS server has the following in log when IE fails:
POST /upload - - ms - -
When I use Chrome however the server log looks like this:
POST /upload 200 5435.018 ms - 60
Not sure what I am doing wrong! Please help!