【问题标题】:internet explorer FileReader result is null for big files对于大文件,Internet Explorer FileReader 结果为空
【发布时间】:2018-12-27 10:08:01
【问题描述】:

在 Internet Explorer 中,当我尝试上传更大的视频文件 (70MB) 时,FileReader.onload this.result(在我的代码中:event.target['result'])为空。

reader.onload = function (event) {
      if (event && event.target) {
        if (event.target['result']) {
          that._file.id = that.id;
          that._file.src = uploadedFile.file;
          that.attachmentForm.controls['fileName'].patchValue(
            uploadedFile.file.name
          );
          that._file.description = uploadedFile.file.name;
          that._file.fileType = uploadedFile.file.type;
          that._file.deleteFlag = false;
          that._file.fileExtension = that.getExtensionFromFileName(
            uploadedFile.file.name
          );
          that.fileUploaded.emit(that._file);
        } else {
          that.error_message = FileUploadErrors.file_corrupted;
        }
      }
    };

    if (uploadedFile.file) {
      reader.readAsDataURL(uploadedFile.file);
    }

当我尝试上传大约 30MB 的文件时,它工作正常。 Windows 能够播放所有视频。 Chrome,firefox 与此代码配合得很好。有什么想法,问题出在哪里?

debug

result null

【问题讨论】:

    标签: file null upload


    【解决方案1】:

    这是因为 IE 不完全支持文件阅读器。对于 IE,文件加载需要分块完成,每个不超过 20MB。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-09
      • 1970-01-01
      • 2011-02-08
      • 1970-01-01
      • 2016-09-24
      • 2021-08-01
      • 2020-01-20
      • 2013-01-30
      相关资源
      最近更新 更多