2017-06-07 228 views
0

Salesforce Lightning組件不會在Internet Explorer 11中附加我的文件,我已經搜索了幾個解決方案,但都沒有工作,有任何想法。對象不支持屬性或方法'readAsBinaryString' - IE11

我附加文件的代碼如下。

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); 
}, 
+0

你能回答我的問題:HTTPS:@Nebbyyy //stackoverflow.com/questions/44561938/object-doesnt-support-property-or-method-readasbinarystring, – Vinoth

回答

0

這個問題來自Lightning Locker Service。我想你還在使用Spring 17版本。從今天開始,所有剩餘的環境都已遷移到Summer 17,默認情況下IE11已禁用了Locker Service。所以你不應該再有這些問題了。

+0

你能回答我一個問題:https://開頭計算器。 com/questions/44561938/object-doesnt-support-property-or-method-readasbinarystring @gloomcore, – Vinoth

相關問題