-1

I use Spring Tools for developing my website. On this site admins can upload images and other files like PDF and CSV, which customers may download later.

When using Spring Tools, I have set the destination folder static/images/ for uploading new images, which worked perfectly. But after deploying that jar on my Linux server, Spring boot could not find the static folder, so I used this function I found: How to get spring boot application jar parent folder path dynamically?

This function does save an image into the classes/static/images folder which was also created with the .jar. However, by visiting website as a customers view, it throws a 404 error. In FTP, I saw that the file was created but clients do not see them. They only see images which were exported in the .jar and were in Spring Tools before. Is this the right way or is there any better?

Demo
  • 13
  • 7

1 Answers1

0

As you have a HTTP server on that machine I would suggest that you store the uploaded files anywhere the HTTP server has access.

Then the static content can be served by the HTTP server.

Simon Martinelli
  • 34,053
  • 5
  • 48
  • 82