0

Salesforce Lightning 组件不会在 Internet Explorer 11 中附加我的文件,我已经搜索了一些解决方案,但没有一个有效,任何想法。

我附加文件的代码如下。

doAttach : function(component, event, helper) {
    var elem = event.target || event.srcElement; 
    var fileInput = $("#file-upload");

    if(fileInput[0].files.length <= 0){
        alert('You have to select a file to upload!');
        return;
    }

    var file = fileInput[0].files[0];
    if(file.size > 4500000){ // 6000000 * 3/4 to account for base64 
        alert('File size cannot exceed ' + this.MAX_FILE_SIZE + ' bytes.\n' +
                'Selected file size: ' + file.size);
        return;
    }

    //display panel loading
    $('#loading-status').css("display", "block");
    $(elem).attr('disabled', 'disabled');

    var filename = file.name;
    var filesize = file.size;
    var fileblob;
    var reader = new FileReader();
    reader.onload = function(readerEvt){
        var binaryString = readerEvt.target.result;
        fileblob = btoa(binaryString);

        var obj = {"filename" : filename,
                   "filesize" : filesize,
                   "body" : fileblob};
        var lstresult = component.get("v.lstAttachments"); 
        lstresult.push(obj);
        component.set("v.lstAttachments", lstresult); 

        $("#elem-upload").css("display", "inline-flex");
        $("#itemUploaded").css("display", "none");  
        $("#tbl-result").css("display", "table");
        $('#loading-status').css("display", "none");
        $("#btn-attach").attr('disabled', 'disabled');
    };
    reader.readAsBinaryString(file);
},
4

1 回答 1

0

这个具体问题来自闪电储物柜服务。我想您仍在使用 Spring 17 版本。从今天开始,所有剩余的环境都已迁移到 Summer 17,默认情况下禁用了 IE11 的 Locker Service。所以你不应该再有这些问题了。

于 2017-06-10T09:30:51.463 回答