Comments (6)
1.图片上传成功了么?
2.浏览器上f12看看接口,请求body里字段有没有值。
from perfect-ssm.
图片上传成功,我大概看了一下你这个上传的逻辑,你的图片基本信息和图片是分别提交到两个Controller去处理的, 基本信息对应的controller是/picture,图片对应的controller是/images,
1.你的图片信息存储的时候,是在 /picture的controller里面进行处理存储的。但是存储的时候picture里面没有设置path值
2.你的path拼接应该是要在/images的controller里完成的,因为你图片的名字是在这个controller里面生成的,但是你这个controller并没有调用service去存储图片路径(我的意思是 upload/+图片名字 拼出来的)
3.以上是我对这个逻辑的分析,可能你的图片path是在别的地方存储到数据库的......也可能是我没找到......
from perfect-ssm.
1.ImageController作为文件上传处理器,只做图片的存储以及路径的返回,不做其他操作。
2.PictureController作为图片信息处理器,负责存储图片的路径及其他信息。
所以图片上传成功不等于路径存储成功,上传成功后会把路径返回给页面,页面会有input域来存储这个值,之后点击保存按钮后,所有信息交给PictureController,然后再调用Service做处理。
不用想得太复杂。
from perfect-ssm.
哦,明白了........,那你为什么不用enctype multipart/form-data直接将图片和数据一起提交到一个Controller处理....我觉得这样逻辑简单些😬
from perfect-ssm.
图片上传是公共服务
from perfect-ssm.
好的,谢谢你
from perfect-ssm.
Related Issues (12)
- 登陆问题 HOT 1
- java 初学 HOT 1
- 关于启动之后无法访问 HOT 1
- 注意事项!!!!
- 运行报错总是404
- 你很调皮啊兄弟 HOT 1
- 图片设置页面没有出现垂直滚动条
- 登录不上 HOT 2
- 你这源码里只有UserDao接口,没有UserDao实现吗? HOT 3
- 反射型xss漏洞
- 关于Redis的一个问题 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from perfect-ssm.