var s = document.getElementById(‘file‘).files[0];
var formData = new FormData();
formData.append("file", s);
$.iBoxWait();
$.ajax({
type: ‘POST‘,
url: "http://www.wfios.com:9299/a/mobile/dataReport/imageUpload",
data: formData,
contentType: false,
processData: false,
dataType: "json",
mimeType: "multipart/form-data",
success: function(data) {
$.iBoxHide();
if (!data.success)
return iG.alert(data.msg);
$("#getCamera img").attr("src", baseImgUrl+data.body.filePath);
fileImg = true;
},
error : function(data){
$.iBoxHide();
iG.alert("连接服务出错,请联系平台技术人员解决。");
}
});
原文:https://www.cnblogs.com/mrt-yyy/p/12875215.html