问题描述
图像未保存在数据库中,但是当我调试代码时会显示为什么(.Add)对象不起作用
if (ModelState.IsValid)
{
// there is Code here
var imageList = new List<AdsImg>();
foreach (IFormFile photoIform in userInfoModelView.Photo)
{
if (photoIform.Length > 0)
{
var stream = photoIform.OpenReadStream();
var img = Image.FromStream(stream);
img.ScaleAndCrop(273,162)
.SaveAs($"wwwroot\\upload\\{photoIform.FileName}");
var img2 = new AdsImg
{
AdId = ad.Id,ImgPath = photoIform.FileName,};
imageList.Add(img2);
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)