我正在研究MVC。我有一个发送电子邮件的表单。剃刀形式在
之下@Ajax.BeginForm("sendEmail", "communication", new AjaxOptions() { OnBegin = "return onBeginFun();", UpdateTargetId = "emailMessage" }, new { id = "communicationForm", enctype = "multipart/form-data" })
{
@Html.TextAreaFor(m => m._Email.Body, new { @class = "form-control editor overflow:scroll; max-height:300px", name = "emailbody", id = "emailbody" })
<input type="file" id="fileUploader" name="fileUploader" multiple ;" />
<button type="submit" id="submitCommunication"> SAVE>>></button>
}
控制器如下
[HttpPost]
[ValidateInput(false)]
public async Task<JsonResult> sendEmail(CommunicationModelView P_CMV, HttpPostedFileBase fileUploader)
{
....................
}
单击提交按钮后,我可以看到模型填充了表单数据,但即使我选择了文件,fileUploader仍为null。
需要帮助。 提前谢谢。