标签:上传数据
function selectSeal() {
document.getElementById("sealinfo").click();
}
function updateSeal(sealimageupdateId) {
var sealinfo = {};
sealinfo.sealimageupdateId = sealimageupdateId;
$.ajaxFileUpload( {
url : ‘${pageContext.request.contextPath}/seal/uploadSealInfo.do‘,
secureuri : false,
fileElementId : ‘sealinfo‘,
dataType : ‘json‘,
data : sealinfo,
success : function(data, status) {
if (data == "0") {
location.reload();
} else {
alert("上传失败");
}
},
error : function(data, status, e) {
alert(e);
}
});
}
<input id="btn_sealchange" type="button" value="更改印章" class="btn btn-info" onclick="selectSeal(${seal.sealImageId});"> <input id="sealinfo" name="file" type="file" onchange="updateSeal(${seal.sealImageId});" style="display: none">
@RequestMapping(value = "uploadSealInfo") public @ResponseBody String uploadSealInfo( @RequestParam(value = "file", required = false) MultipartFile file, @RequestParam(value = "sealimageupdateId") Long id,HttpServletResponse response) { try { byte[] sealByte = file.getBytes(); SealInfo sealInfo = new SealInfo(); sealInfo.setFileData(sealByte); sealInfo.setId(id); this.sealService.uploadSeal(sealInfo); return "0"; } catch (IOException e) { e.printStackTrace(); return "-1"; } }
标签:上传数据
原文地址:http://yjm199.blog.51cto.com/4408395/1771691