0
我想將複雜模型屬性發布到HttpPostedFileBase
。MVC post complex HttpPostedFileBase
控制器
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(AlbumImagesLoc entity, int albumId, HttpPostedFileBase ImageUrl)
{ }
查看
@Html.TextBoxFor(model => model.AlbumImage.ImageUrl, new { type = "file" })
@Html.ValidationMessageFor(model => model.AlbumImage.ImageUrl)
現在的問題是HttpPostedFileBase
總是null
,因爲它的名字必須是AlbumImage.ImageUrl
。
如何避免MVC代碼中的null
?