Click here to Skip to main content
15,910,210 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

Dear all,
when we stored images or pdf in application folder then we faced a problem of application slowing down & when we store in database then size of database is increasing day by day so what is the the best way to store images/pdfs.

Thank you in advance.......
Posted
Updated 27-Jul-15 0:10am
v2
Comments
Sreekanth Mothukuru 27-Jul-15 6:15am    
You could store images or pdf on third party servers like AWS S3 or any other service and store its location on your Database to access it later on.

1 solution

That's going to depend entirely on why you are storing them.
Personally, I use it for documentation, change notices, and so forth so I need multiple copies available.
I use a combination of database and files:
The files themselves are stored in a folder (root/Resources/Documents) under a GUID filename, and the path to that file, the original file name, the version, and date information is stored in the DB.

This allows me to reference the latest version of everything with a "simple" SQL query, and access the files from the query results, without having to reference the file system to list my files or take too much DB space.
 
Share this answer
 
Comments
Kornfeld Eliyahu Peter 27-Jul-15 6:20am    
It is fascinating...We have the exact same solution including the GUID for file names and versioning...
OriginalGriff 27-Jul-15 6:39am    
Great minds and all that!
You don't want to store it under the original file name - there could be different docs with the same name - so Guid is a sensible way to go. Much easier than reading the folder and working out the largest number so far! :laugh:

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