我正在尝试Dart,但我无法弄清楚,如何将图像从用户发送到服务器.我有我的输入标签,我可以在DART代码中达到此目的,但我似乎无法从中读取.我想尝试类似的东西:
InputElement ie = document.query('#myinputelement');
ie.on.change.add((event){<br/>
InputElement iee = document.query('#myinputelement');<br/>
FileList mfl = iee.files;<br/>
File myFile = mlf.item(0);<br/>
FileReader fr = new FileReader();
fr.readAsBinaryString(myFile);
String result = fr.result; //this is always empty
});
Run Code Online (Sandbox Code Playgroud)
使用html包含:
<input type="file" id="myinputelement">
Run Code Online (Sandbox Code Playgroud)
我真的希望你不能帮助我,我有点卡住了.我可能只是想知道如何为文件读取器执行onload,或者我可能完全错误.