在利用Html.BeginForm时能够正确上传,但改为Ajax.BeginForm则服务器端接受不到文件
代码如下
View:
@using (Ajax.BeginForm("StartPlacePicUpLoad", "Place", new { id = ViewBag.Place.PlaceId }, new AjaxOptions { HttpMethod = "Post", OnSuccess = "OnUpLoadSuccess" }, new { id = "upload", enctype = "multipart/form-data" }))
……
<input type="file" id="btnUpFile" name="ImageFile" style="width:400px"/>
……
c#:
public JsonResult StartPlacePicUpLoad(int id,HttpPostedFileBase ImageFile)
{
ImageFile总是为null
…………………………
}
求解决方法
------解决方案--------------------------------------------------------
Ajax无法上传文件,网上类似的插件多是用隐藏的iframe实现的