我在编辑表单中有这样的代码。
@using (Html.BeginForm("Bind", "Student", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<img id="sp" src="/Student/RetrieveImage/model.StudentID" alt="Photo" height=100 width=200 />
<input type="file" name="ImageData" id="ImageData" onchange="DI();"/>
}
这在学生控制器中
HttpPostedFileBase file;
public ActionResult Bind()
{
file = Request.Files["ImageData"];
file = Request.Files["ImageData"];
return RedirectToAction("StudentEdit");
}
开始表单在编辑表单中找到,它是一个部分表单。我需要的是从输入文件中选择文件时触发绑定操作。我怎样才能做到这一点?