0

I'm new in MVC I want to know how to upload a file or an image in MVC. Actually I'm using database first approach in which I've database already. I created a Entity Data Model and using auto generated code. Now my field type is Image in database but it's actually does not create Image field in view. Is it not supported in MVC 4?

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291
Nomi Ali
  • 2,165
  • 3
  • 27
  • 48
  • 1
    You should avoid the image type in SQL (http://msdn.microsoft.com/en-us/library/ms187993.aspx), use VARBINARY instead if you want to store in a database (http://stackoverflow.com/questions/5613898/storing-images-in-sql-server). You could also store in the file system. – Aage Nov 29 '14 at 14:35

1 Answers1

2

There is answer:

MSDN:

image data type will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use varbinary(max) instead

You should use varbinary(max) and it will transfer to model in entity framework.

Kirill Bestemyanov
  • 11,946
  • 2
  • 24
  • 38