[HttpPost]
public void Test(HttpPostedFileBase file)
{
UsersContext db = new UsersContext();
byte[] image = new byte[file.ContentLength];
file.InputStream.Read(image, 0, image.Length);
CrimeReport i = new CrimeReport
{
ImageId=1, ImageName="Ali",ImageContent = image,
Active=true
};
db.CrimeReports.Add(i);
db.SaveChanges();
}
我在db.CrimeReports.Add(i);
上遇到异常