Tell me more ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I have trouble reading the Uploaded File (XLSX) via FileReader API's "readAsBinaryString" method in IE10. "readAsText" method works fine. Has anyone come across this, does IE support this method? Am I missing something. Pls find the snippet below:

function handleFileUpload(evt){

    evt.stopPropagation();
    evt.preventDefault();

    var files = (evt.target.files || evt.dataTransfer.files);
    var output = [];

    for (var i = 0, f; f = files[i]; i++) { 
        output.push('<li><strong>', escape(f.name), '</strong> (', f.type || 'n/a', ') - ', f.size, '   bytes, last modified: ', f.lastModifiedDate ?                                   
        f.lastModifiedDate.toLocaleDateString() :   'n/a', '</li>');

        var reader = new FileReader();
        reader.onload = function(e) {
            var data = e.target.result;
                        alert("-- Data Length --" + data.length);
           };

         // Read in the XLSX file in Binary Mode.   
         //reader.readAsBinaryString(f);//<-- ***does not work if this method is used in IE10 (10.0.9200.16540C0), but works on Chrome***   
           reader.readAsText(f);//<-- ***Works on both Chrome & IE10 (10.0.9200.16540C0)***

    }//for 

}//handleFileUpload 
share|improve this question
3  
This question has nothing to do with salesforce and would be better served on stackoverflow.com – Phil R Apr 13 at 15:26
1  
I agree, although the II part of the requirement is to send the contents & file back to Force.com (insert the rows in XLSX into Force.com custom Object and the file as an attachment). I shall post it as you suggested, thanks. – SKALIDHASAN Apr 14 at 4:12
No need to downvote the guy to oblivion... – user320 Apr 15 at 10:55

closed as off topic by Wes Nolte, Mike Chale, jkraybill, Ralph, Sdry Apr 15 at 12:45

Questions on Salesforce Stack Exchange are expected to relate to Salesforce within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

Try using reader.readAsArrayBuffer(f)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.