如果我不引用
jquery.unobtrusive-ajax.js
,我可以在Post上获取附件。如果我引用它,它会给我返回null。<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
@using (Ajax.BeginForm("Index", "ContactSubmission", new AjaxOptions{ InsertionMode = InsertionMode.Replace, HttpMethod = "POST", OnSuccess = "updateSuccess" },
new { enctype = "multipart/form-data",@class = "form-horizontal", role = "form" }))
{
///code here
}
[HttpPost]
public JsonResult Index(Contact contact)
{
if (ModelState.IsValid)
{
if (contact != null)
{
string attachment = string.Empty;
// HttpPostedFileBase Attachment
if (contact.Attachment != null) attachment = SaveFile(contact.Attachment);
......
如何应对这种情况?