Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java/JSP Image upload. Where to keep these image files?

I am writing a simple application that lets a user upload images. After the upload, the user can tag them or remove them.

I figured out how to upload the files and save them once the files are uploaded. I am keeping tracking of a global path where images are kept. In the database I keep the meta data about the images like file name, tags, etc.

I am using Java/JSP (specifically Stripes framework but my problem is generic).

My question is where do I keep these image files once they are uploaded?

Right now I have two web applications deployed on a Tomcat server. One main web application and other one is the where I upload the images.

But this does not work as I can not see the uploaded images in the main application until I redeploy/restart Tomcat.

It seems like Tomcat does not pick newly uploaded images automatically.

Does anyone have any solutions?

This is a simple project, so I do not want to store them in a database or use Apache for images. That is all just too complicated for this small project.

Thanks.

like image 410
TRF Avatar asked Dec 22 '08 01:12

TRF


1 Answers

Definitely don't store the images in the database, but you will want to store the image path in the database. This will allow you to store the image just about anywhere.

Since you are using two tomcat applications, your best bet may be to store the images outside of either app and stream the image back to the user instead of letting tomcat manage the files. Otherwise, I would ask why you are trying to do this with two web apps.

like image 118
Chris Johnston Avatar answered Sep 28 '22 08:09

Chris Johnston