Giter Site home page Giter Site logo

Comments (6)

ZHENFENG13 avatar ZHENFENG13 commented on June 29, 2024

1.图片上传成功了么?
2.浏览器上f12看看接口,请求body里字段有没有值。

from perfect-ssm.

Dorothylyly avatar Dorothylyly commented on June 29, 2024

图片上传成功,我大概看了一下你这个上传的逻辑,你的图片基本信息和图片是分别提交到两个Controller去处理的, 基本信息对应的controller是/picture,图片对应的controller是/images,
1.你的图片信息存储的时候,是在 /picture的controller里面进行处理存储的。但是存储的时候picture里面没有设置path值
2.你的path拼接应该是要在/images的controller里完成的,因为你图片的名字是在这个controller里面生成的,但是你这个controller并没有调用service去存储图片路径(我的意思是 upload/+图片名字 拼出来的)
3.以上是我对这个逻辑的分析,可能你的图片path是在别的地方存储到数据库的......也可能是我没找到......

from perfect-ssm.

ZHENFENG13 avatar ZHENFENG13 commented on June 29, 2024

1.ImageController作为文件上传处理器,只做图片的存储以及路径的返回,不做其他操作。
2.PictureController作为图片信息处理器,负责存储图片的路径及其他信息。

所以图片上传成功不等于路径存储成功,上传成功后会把路径返回给页面,页面会有input域来存储这个值,之后点击保存按钮后,所有信息交给PictureController,然后再调用Service做处理。

不用想得太复杂。

from perfect-ssm.

Dorothylyly avatar Dorothylyly commented on June 29, 2024

哦,明白了........,那你为什么不用enctype multipart/form-data直接将图片和数据一起提交到一个Controller处理....我觉得这样逻辑简单些😬

from perfect-ssm.

ZHENFENG13 avatar ZHENFENG13 commented on June 29, 2024

图片上传是公共服务

from perfect-ssm.

Dorothylyly avatar Dorothylyly commented on June 29, 2024

好的,谢谢你

from perfect-ssm.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.