0
私は複数のファイルの投稿に取り組んでいます、私はHttpPostedFileBase
を使用しています。ファイルHttpPostedFileBase upload投稿部分ビューのNULL MVC
フォームを送信する場合、file
プロパティはnull
です。
モデル
public partial class Driver
{
public int DriverId { get; set; }
public string DriverFirstName { get; set; }
....
public List<DriverImages> DriverImages { get; set; }
}
public class DriverImages
{
public int DriverImageID { get; set; }
public string ImagePath { get; set; }
public string Description { get; set; }
public HttpPostedFileBase file { get; set; }
}
パーシャルビュー
@model DataModel.DriverImages
...
@using (Design.Common.HtmlPrefixScopeExtensions.BeginCollectionItem(this.Html, "DriverImages"))
{
<table>
<tr>
<td>
@Html.TextBoxFor(m => Model.Description)
</td>
<td>
<input type="file" name="file" />
</td>
</tr>
</table>
}
コントローラ
[httppost]
public ActionResult Create(Driver ObjDriverModel, HttpPostedFileBase[] files)
{
// ObjDriverModel.DriverImages.file // always null
}
greattt help ...そのファイルを投稿しています。 –