首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

Asp.net MVC3 Ajax文件下传

2012-08-26 
Asp.net MVC3 Ajax文件上传在利用Html.BeginForm时能够正确上传,但改为Ajax.BeginForm则服务器端接受不到

Asp.net MVC3 Ajax文件上传
在利用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实现的

热点排行
Bad Request.