weixin_33709590 2017-05-12 10:39 采纳率: 0%
浏览 41

IE 11无法上传Ajax文件

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!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
    • ¥15 关于arduino编程toCharArray()函数的使用
    • ¥100 vc++混合CEF采用CLR方式编译报错
    • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
    • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
    • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
    • ¥50 如何openEuler 22.03上安装配置drbd
    • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
    • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
    • ¥15 Windows11, backspace, enter, space键失灵