file - 大文件的 Internet Explorer FileReader 结果为空

标签 file null upload

在 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

最佳答案

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

关于file - 大文件的 Internet Explorer FileReader 结果为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51419779/

相关文章:

entity-framework - 2 个属性中的一个应该为空(EntityFramework Code First)

objective-c - 从包含\0 个字符的 char 数组创建 NSString?

javascript - 有没有办法将文件附加到已经存在的文件列表中? javascript 文件接口(interface)

image - Drupal 7 - 以编程方式上传图像

mysql - MySQL查询缓存文件保存在哪里?

c++ - 将多个文件合并为一个

c# - FileSystemWatcher 有一个奇怪的行为

c - 重新分配后如何将新内存清零

ruby-on-rails - 建议请求 : Serve local folder through rails (or not? )

linux - 如何将程序的输出存储到文件中?