我使用HttpPostedFileBase作为文件的模型,但是文件来了 控制器无效,我想使用AjaxForm,因为Asp.net不提供我需要发布此抛出ajax的常规BeginForm吗?
@using (Ajax.BeginForm("UploadImg", "Controller", Object,
new AjaxOptions { HttpMethod ="Post", OnComplete = "Something();" },
new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
<div class="col-lg-7">
@Html.TextBoxFor(model => model.File, new { type = "file", @class = "form-control", required = "required" })
<input type="submit" value="Upload" class="btn-primary" />
</div>
</div>
</div>
}