中文加密解密的js下载链接:https://download.csdn.net/download/rosener/10376216
配置config.js
配置controller.jsp
将lib里面自带的jar包添加到项目中,
在oss上传的controller中添加方法:
@RequestMapping("/fuwenbenImg") public Map<String, String> fuwenbenImg(HttpServletRequest request, HttpServletResponse response) { Map<String, String> msg = new HashMap<String, String>(); // "image/2014/2.jpg" srcAddress格式 MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; // 获得文件: MultipartFile file = multipartRequest.getFile("upfile"); if (file != null) { OSSClient ossClient = new OSSClient(ENDPOINT + DOMAIN, ACCESSKEYID, ACCESSKEYSECRET); try { // 上传文件 PutObjectResult p = ossClient.putObject(MEMBERBUCKET, file.getOriginalFilename(), file.getInputStream()); if (p != null) { msg.put("state", "SUCCESS"); msg.put("url", ENDPOINTS + ADDRESS + "/" + file.getOriginalFilename()); ossClient.shutdown(); return msg; } msg.put("type", "3"); msg.put("msg", "上传失败!"); ossClient.shutdown(); return msg; } catch (Exception e) { e.printStackTrace(); msg.put("type", "4"); msg.put("msg", "程序异常!"); ossClient.shutdown(); return msg; } } else { msg.put("type", "2"); msg.put("msg", "srcAddress或者media存在空值!"); return msg; }
}
在js界面引入
js中的写法:
这块要说的是数据库中varchar类型的只能存储2万多字节,可以改成longText,就可以存储进去了
本文地址:http://lanlanwork.gawce.com/quote/10554.html 阁恬下 http://lanlanwork.gawce.com/ , 查看更多