0

Salesforce Lightning component won't attach my files in internet explorer 11, I have searched for a few solutions but none have worked, any ideas.

My code for attaching the file is as follows.

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);
},
Nebbyyy
  • 358
  • 4
  • 20
  • can you answer my question:https://stackoverflow.com/questions/44561938/object-doesnt-support-property-or-method-readasbinarystring @Nebbyyy, – Vinoth Jun 15 '17 at 08:26

1 Answers1

0

This specific problem comes from Lightning Locker Service. I suppose you were still using release Spring 17. Starting from today all remaining environments has been migrated to Summer 17, which has by default disabled Locker Service for IE11. So you shouldn't have those issue anymore.

Gloomcore
  • 940
  • 7
  • 11
  • can you answer my question:https://stackoverflow.com/questions/44561938/object-doesnt-support-property-or-method-readasbinarystring @gloomcore, – Vinoth Jun 15 '17 at 08:25