$("input[type='file']").change(function(){
//兼容ie浏览器,因为ie没有FileReader.readAsBinaryString
if(this.files && this.files[0]){
fr.readAsArrayBuffer(this.files[0]);
fr.onload = function(e){
var bytes = new Uint8Array(e.target.result);
var length = bytes.byteLength;
var binary = "";
for (var i = 0; i < length; i++) {
binary += String.fromCharCode(bytes[i]);
}
var base64Str = encodeURIComponent(btoa(binary));
var fileName = encodeURIComponent(this.files[0].name);
}.bind(this);
}
//其他浏览器
if(this.files && this.files[0]){
var fr2 = new FileReader();
fr2.onload = function(e){
var _fr2Base64 = encodeURIComponent(btoa(e.target.result));
};
}
})