Save files in database with entity framework

前端 未结 4 752
故里飘歌
故里飘歌 2020-12-30 02:57

I have an ASP.NET MVC solution built on Entity Framework with Microsoft SQL Server 2008. I need to create a function that lets my users upload files.

What I would l

4条回答
  •  -上瘾入骨i
    2020-12-30 03:38

    In your entity model, map the BLOB database column to a byte[] property. Assign the content of the uploaded file to that property of the entity object, and save changes in the ObjectContext.

    To compute a hash, you can use the MD5CryptoServiceProvider class

提交回复
热议问题