I’m trying to create an ImagesController in MVC4 like this

But I keep getting this error.

Had no problem creating controller for PeopleController using this class
public class Person
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public virtual IEnumerable<Affair> Affairs { get; set; }
}
The problem is with your
Fileproperty on theImageclass. Because EntityFramework won’t understand the typeHttpPostedFileBaseand can’t store it in the DB and the controller generator is smart enough to check this. Altough the error message doesn’t tell you what is the problem. To fix this you should rewrite your property to use a byte array:And then the controller generation should work. And you can add your own image upload action, something like this: