发表于: 2017-11-18 21:13:51
2 696
今天完成的事情:
解决上传问题,完成七牛云图片上传.
这里说一下使用MultipartFile 需要注意的地方.
第一.在application里面配置的时候要注意 bean id="multipartResolver" 这个id名字是可以有任何改变.
第二,<form action="/a/u/upUserImage" enctype="multipart/form-data" method="post"> 这个 enctype="multipart/form-data" 不能缺少也不能有任何错误, 多个空格就会出问题.
第三.@RequestParam("file" 里面这个"file"和 :<input type="file" name="file"><br/> 里面name必须一致.
第四. input type="submit" value="提交" type类型必须为"submit"
添加更改image.
//默认不指定key的情况下,以文件内容的hash值作为文件名
String key = s2;
String upload = qiNiuImage.upImage(file, s2);
if (upload != null){
Student student = new Student();
student.setUserName(s2);
String urlImage = "http://ozi46fb63.bkt.clouddn.com/" + s2 ;
student.setImage(urlImage);
boolean i = studentService.updateStudentImage(student);
loggerStudentController.info("更改数据库图片" + i);
}
然后搞腾讯云的图片上传..拿的师兄工具类,不贴图了..
明天的计划:
完成腾讯图片上传.
完成图片迁移,从七牛云到腾讯.
遇到的困哪:
昨天那个前端往后端的传值问题, 换了一个jsp页面之后已经解决. 前端上传图片已经可以上传到七牛云.
任务进度:任务7步骤2
任务开始时间:2017-11-13
预计demo时间:2017-11-21
是否有延期风险:暂无
禅道:http://task.ptteng.com/zentao/task-view-13479.html
评论