ajax multipart/form-data 上传

var s = document.getElementById('file').files[0];//$(this)[0].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("连接服务出错,请联系平台技术人员解决。");
}
});

posted @ 2020-05-12 11:41  mrt_yy  阅读(5608)  评论(0编辑  收藏  举报