I have an Entity Framework-based ASP.NET MVC application with Microsoft SQL Server 2008 installed. I must develop a feature that enables file uploading by my users.
What I'm looking for is:
In a SQL Server 2008 database, the "correct" approach to store a file is to utilize the data type FILESTREAM. Although the Entity Framework doesn't seem to allow it, you may absolutely give it a go and see what occurs.
However, the majority of the time when this is done, the file is not saved to the database. By doing this, you are forcing a file that might be served straight from the web server to pass via ASP.NET and the database server. Additionally, it can make your database and site's backup situation a little more complicated. Because of this, when files are uploaded to our MVC/Entity Framework, we merely retain a reference to the file location in the database and keep the actual file somewhere else.
Obviously, the specifics of your application will have a big impact on which technique is best for you.