0

Le composant Salesforce Lightning n'attachera pas mes fichiers dans Internet Explorer 11, j'ai cherché quelques solutions mais aucune n'a fonctionné, aucune idée.L'objet ne supporte pas la propriété ou méthode 'readAsBinaryString' - IE11

Mon code pour attacher le fichier est le suivant.

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

pouvez-vous répondre à ma question: https: //stackoverflow.com/questions/44561938/object-doesnt-support-property-or-method-readasbinarystring @Nebbyyy, – Vinoth

Répondre

0

Ce problème spécifique provient du service Lightning Locker. Je suppose que vous utilisiez encore la version Spring 17. À partir d'aujourd'hui, tous les environnements restants ont été migrés vers Summer 17, qui a désactivé par défaut Locker Service for IE11. Donc, vous ne devriez plus avoir ces problèmes.

+0

pouvez-vous répondre à ma question: https: // stackoverflow. com/questions/44561938/object-doesnt-support-propriété-ou-méthode-readasbinarystring @gloomcore, – Vinoth