Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am working on some asp.net website in which users can upload multiple images, Previously i am storing images to database and so that my database size is going too large. Even Godaddy is allow only 200mb database size. So i have to choose any alternative solution...

someone suggests me to store images in a folder and save its path to the database. Before apply this to my project i have some questions.

My question is suppose one user store flower.jpg image and then second user storing different file but with same name flower.jpg, will the first image is replace by second one? or both images will store. If both image will store with same name then how can i recognize which image is upload by which user.

Later on i have to retreive these images on repeater control and in aspx page, i think it will not create any problem while retreiving. Is any drawback for storing images in a folder.
Give your opinion.
Posted

Could you include a users unique id in the pathname when saving the images?
i.e. image-path-name + "/" + user-id + "/" + flower.jpg
 
Share this answer
 
Quote:
Suppose one user store flower.jpg image and then second user storing different file but with same name flower.jpg, will the first image is replace by second one?

Possible. But, you can store it for different user.
Example: (for user1) The images will be stored in the path Images\Users\User1
(for user2) The images will be stored in the path Images\Users\User2
or something like that..

Quote:
If both image will store with same name then how can i recognize which image is upload by which user.

It is how you design your database for you to find it out. Primary key will help I think.
 
Share this answer
 
use of GUID is good solution for not overwriting the images.
http://www.webcodeexpert.com/2014/03/how-to-uploadsave-image-in-folder-and.html[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900