@using (Html.BeginForm("Create", "Yamaha", FormMethod.Post, new { id = "CreateBikeForm", enctype = "multipart/form-data" }))
{
<input type="file" name="file" id="jsonimage"/>
@Html.TextBoxFor(a => a.Image, new { type="file"})
}
这个脚本:
var serializedform = $("#CreateBikeForm").serialize();
$.post("/Yamaha/Register/", serializedform, function (data) {
alert(data);
});
在此searialized形式中不包含图像属性。