Schyzotrop
Schyzotrop

Reputation: 217

Where to store user uploads in spring mvc application?

I am wondering where should i save files uploaded by user in my application. Right now i am saving them right into webapps/images/uploads(webapps folder is mapped as resource folder via mvc-resource) folder and they are instantly available to display after upload. But i am not sure if this is the right thing to do? how will redeployment of application affect the files already stored there? won't it complicate back ups of application? so basically where should i store them on server? and is this affected somehow by using local(windows) or remote(linux) server Thanks

Upvotes: 6

Views: 2217

Answers (1)

Kartoch
Kartoch

Reputation: 7779

I will use a separate directory outside the webapp directory of the application server. In case of update of the application, this seems more appropriate. Just be careful how you save the file name in the database (it's better to save the file without any path, in case of changes).

Upvotes: 5

Related Questions