Spring Boot images uploading and serving

前端 未结 3 1515
南方客
南方客 2020-12-30 10:22

I\'m making new Spring Boot app and want to be able to store and serve images, I want images to be stored in applications directory:

this is what uploading look

3条回答
  •  时光取名叫无心
    2020-12-30 10:53

    You can store external files in a folder named /static in the same directory as your jar and spring will scan them by default. So if you have static/images/ you can reference your images with:

    So you would want to use new File("/static/images/" + imgName);

提交回复
热议问题