想通过转换成Base64
var reader = new FileReader(); reader.readAsDataURL(Bolo); //这个位置要传Bolo 对象reader.onload = function(e){ console.log(e.target.result); }
MDN 有这种方式但不知道怎么补全
var oReq = new XMLHttpRequest(); oReq.open("GET", "/myfile.png", true); oReq.responseType = "arraybuffer"; oReq.onload = function (oEvent) { var arrayBuffer = oReq.response; // Note: not oReq.responseText if (arrayBuffer) { var byteArray = new Uint8Array(arrayBuffer); for (var i = 0; i < byteArray.byteLength; i++) { // do something with each byte in the array } } }; oReq.send(null);
http://runjs.cn/detail/4kmutrhc
相关分类