aspose file tools*
The moose likes Servlets and the fly likes Uploading an image to a server or to database? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Uploading an image to a server or to database?" Watch "Uploading an image to a server or to database?" New topic
Author

Uploading an image to a server or to database?

harbir hundal
Greenhorn

Joined: May 07, 2011
Posts: 14

Hi All,
I am trying to implement the profile page for the user of the web application.
I want the user to be able to upload the image for their profile.
My question is that how should this be implemented?
Should I upload the image in the database as a blob, or shall I upload the image in the server and store the path in the database?
What should be the optimum size of the an image, for user profile?
I am using the following.
1. Mysql 5.5.11
2. Spring 3
3. hibernate

Your help will be appreciated.
Regards
Adofo
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Do you mean a small icon/photo, say 60x60? Its so small that it makes no difference which you pick.

This is purely an engineering decision. Normal tradeoff. The obvious advantage of using a blog in MySql is that you don't have to think about managing the data. If you store it as a file, you need to manage the file structure, take care of when it gets full, fix broken links, etc.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Uploading an image to a server or to database?