Skip to content Skip to sidebar Skip to footer

Filereader To String

Consider the following code function readSingleFile(evt) { //Retrieve the first (and only!) File from the FileList object var myFile = evt.target.files[0]; var reader =

Solution 1:

That's not how you get the result of a FileReader. Modify your code to this:

function readSingleFile(evt) {
        //Retrieve the first (and only!) File from the FileList object
        var myFile = evt.target.files[0];
        var reader = new FileReader();
        reader.readAsText(myFile);
        reader.onload=function(){alert(reader.result)}
    }

Post a Comment for "Filereader To String"