Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I see alot of posts in my research about uploading and downloading files that have a mapped folder to save files, but still use a database to hold information regarding the file, so my question is, is this normal? Do you have to have a folder to save the file to when uploading a file in an asp.net application, or can you skip this and just have the info in the database? I am confused about this as I am still new to coding and best practices.

If infact this is normal, do I save it in the application in a folder? Or should I have it save files to an external folder on the server that the application will run on?

Keep in mind, if this program is to ever be used, it may not stay on the same server as which it was built, I need easy migration.

Being this new, to me this is a tough question to phrase right and or find answers to, if you understand, or need clarification, or have answers please let me know.

I apologize for multiple questioning, but these are things I need to know, to proceed with building my application, and it being my first application, and "self taught" I don't know these answers, Thank you in advance!

What I have tried:

researching, still clueless as to best practices.
Posted
Updated 8-Apr-17 15:52pm

1 solution

1. If you choose the file(data) to save in DB then you need to convert the file into binary and then store the binary content in the DB. At the time of retrieve again you need to convert the binary content to your file...
2. If you use a folder to save the file in the application then it may caused the application file huge.
3. It will be good, if you choose the file to store in another sever with unique file name and save that file name in db table column.
 
Share this answer
 
Comments
Timothy Heckler 9-Apr-17 9:33am    
It sounds like saving as binary in DB is the best option, So the only field in the Table I need to create is one varbinary field?
Ramesh Kumar Barik 9-Apr-17 9:44am    
As per my suggestion save the file in another server and save the path in your database to know the file identity.
If you save the file content (binary) then your DB size my be heavy, if lots of file posted from the application. If you know your file is less then go for this option.
Thanks. :)

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