<input id= "Btn_sealchange" type= "button" value= "Change Seal" class= "Btn btn-info" onclick= " Selectseal (${seal.sealimageid}); " ><input id= "Sealinfo" name= "file" type= "file" onchange= "Updateseal (${seal.sealimageid});" Style= "Display: none" >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 ("Upload failed"),}},error : function (data, status, e) {alert (e);});} @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";}} <!-- mybatis background update blob field data --><update id= "Updatebyprimarykeyselective" parametertype= "Com.itrus.msign.entity.SealInfo" >update seal_info set file_data=#{ Filedata}where id = #{id,jdbctype=bigint} </update>
MySQL Update large field