form裡面一定要加入enctype = "multipart/form-data" Controller才會取得二進位制資料
@using (Ajax.BeginForm("FileUpload", "xxx", null, new AjaxOptions { HttpMethod = "Post", OnSuccess = "" }, new{ @enctype = "multipart/form-data" }))
{
<input type="file" name="files" class="form-control">
}
[Authorize]
[HttpPost]
public ActionResult FileUpload(FormCollection form, IEnumerable<HttpPostedFileBase> files)
{
}
沒有留言:
張貼留言