我試着飛鏢,但我無法弄清楚,如何發送圖像從用戶到服務器。我有我的輸入標籤,我可以在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
});
與包含HTML:
<input type="file" id="myinputelement">
我真的希望你不能幫我而言,我有點卡住。我可能會錯過如何爲文件讀取器執行onload,或者我可能會完全錯誤。
是否經由'文件裝載Chrome中的網頁://'協議?如果是這樣,您可能需要啓用一些標誌http://stackoverflow.com/a/7691772/180740 - 或者上傳文件來通過HTTP訪問它們。 – 2012-02-09 16:25:11