js:


$("#btnImg").click(function () {
$("#form0").ajaxSubmit({
url: "/Student/Img",
type: "post",
success: Math,
})
return false;
})
function Math(data) {
$("#Imgurl").val(data);
$("#result").html(" <img src='" + data + "' style='width:80px;height:60px' />")
}

html:

td>头像</td>
<td><input id="ImgMath" type="file" name="ImgMath" /><input id="btnImg" type="button" value="预览" /></td>
@Html.Hidden("Imgurl")
<td><span id="result"></span></td>

coller:

[HttpPost]
public ActionResult Img()
{
var Maph = Request.Files["ImgMath"];
string ImgPath ="/Content/img/" + Maph.FileName;
string Ser_Img = Request.MapPath(ImgPath);
Maph.SaveAs(Ser_Img);
return Content(ImgPath);
}