Answer the question
In order to leave comments, you need to log in
How to properly store image files in a web application?
How to properly store images in a web application written in java? At the moment, I have the following principle: a person uploads a photo from the site to the server, the server sends the information to the database and stores the path to the image there. The image itself is placed in the WebContent folder. But after recompiling the project, all photos are deleted. So what's the best way to store files in a web application?
Answer the question
In order to leave comments, you need to log in
Dynamics (pictures, icons, logotypes, etc., everything that can be loaded at runtime) and statics (what never changes at runtime) should be kept separately. Firstly, in order not to lose data when redeploying or adding a new node / instance of your application, and secondly, static content is served much faster through special. server than through a container ala tomcat or some jboss.
Have a look at Apache HTTP Server to get started . Easy to use, minimal settings to get started, lots of examples. Then try a more advanced solution.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question