Hello All.
I have a problem with the filereader in dart:html. Im trying to read
an inputfile, which is given from a <input>. I have come as far as
calling the readAsBinaryString, but the result is always empty. I
think this is a result of me not using the callback, but i dont really
know how. I really hope you can help. Below is some code, that should
clerify what my problem is:
InputElement inp = new Element.tag('input');
inp.id = "myInp";
inp.type = "file";
DivElement de = document.query('#divele');
de.insertAdjacentElement('beforeEnd',inp);
inp.on.change.add((event){
InputElement myInput = document.query('#myInp');
FileList mfl = myInput.files;
File myFile = mfl.item(0);
FileReader fr = new FileReader();
fr.readAsBinaryString(myFile);
String myResult = fr.result; //this is always empty! which is
the problem
});