Springboot project, the backend stores pictures to a directory of the project, how to write the path?

1.springboot project structure is shown in the figure

clipboard.png

2.UploadControllerimages
"templates/images/","./main/resources/templates/images/" url:

clipboard.png

Mar.01,2021

your front-end url is a temporary cache url, not the actual url of the server.
your function is to upload pictures. Then get the image stream directly on the Controller side and write it to the corresponding directory.

 
UploadController is responsible for receiving the picture file at the backend and saving it to the images path of the project

the key is to just store it, right? What to do after storage (such as as a resource for users to access? )? If it's just storage, just find a directory on the server to store it

.
Menu