3,143
社区成员
发帖
与我相关
我的任务
分享
function uploadImg(_this){
var suxFix = _this.id.match(/\_(\d+)/);
var idx = suxFix[1];
var next = parseInt(idx)+1;
lrz(_this.files[0], {width: 1000}, function (results) {
//console.log(results); //debug
var xhr = new XMLHttpRequest();
var data = {
base64: results.base64,
size: results.base64.length
};
xhr.open('POST', baseUrl_online+"bs/file/upload/image");
xhr.setRequestHeader('Content-Type', 'multipart/form-data; charset=utf-8');
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status <300 || xhr == 304) {
var result = JSON.parse(xhr.response);
$("#picimg_"+idx).attr("src",result.data).css("z-index","1");
$("#pic_"+next).css("display","");
}
};
xhr.send(JSON.stringify(data));
});
}