0
当我用下面的代码在控制器HttpPost不MVC3工作
[HttpPost]
public ActionResult Index(HttpPostedFileBase file)
{
string path = Path.Combine(Server.MapPath("~/Images"),
Path.GetFileName(file.FileName));
file.SaveAs(path);
ViewBag.Message = "File Uploaded Successfully";
return View();
}
当我运行我得到了以下错误
---Server Error in '/' Application.
---The resource cannot be found.
应用程序当我删除[HttpPost]
它加载,但文件没有上传...
任何人都可以帮助我吗?......
您是否可以使用用于从视图中调用操作的代码/表单来更新您的问题? – nemesv 2012-07-17 08:00:06
控制器中是否有另一个'Index'方法具有属性'[HttpGet]'? – 2012-07-17 08:04:00