Search code examples
c#asp.net-mvcentity-frameworkef-code-firstsqlfilestream

Storing documents in database ASP.NET MVC5 with EF6 - code-first


I am currently working on a project that needs to store about 5x2mb files for each user in the system. There will eventually be tens of thousands of users. I'm using ASP.NET MVC5, EF6 code-first.

I've read about using Filestream, so that I don't pollute the database with a lot of files. But I can't find any samples as to how I would write my code-first entity to use this type.

Any sample or alternative solution is much appreciated!


Solution

  • Best way to do this is to upload the files on a server and store the path of the files in your database. This is way more easier and faster. You have tons of tutorials and NuGet packages how to upload (multiple) files (at once) in MVC.