开发者

Help with storing images on a server and what to store in the database with java servlet?

I want to store images related to a particular row in my table, So my table is called spot, and each spot can have multiple images, should i just store the images in a folder on the server and then store a location to that folder in a column of that row called imagesLocation?

or should there be other information encorporated?

any ide开发者_StackOverflow社区as?


You are on the right track - store the images on the file system (preferably where they can be seen by the web server), and store just a path to them in the database. This can greatly reduce I/O to your database server. Often you will just create a <img> tag with the path, so you can lead the loading/caching of these files to your webserver - which it is really good at.


Yes, you should store the file in the file system and the location of the file in the database. In my experience the database connectors perform very poorly on large pieces of binary data in the database.

You should store all the meta-information you need in the database so you don't need to rely on the OS for anything else than storing the raw bytes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜