且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

创建新模型时上传图像

更新时间:2023-12-01 12:54:28

除非您的表单元素包含enctype = "multipart/form-data"属性,否则不会在请求中发送文件输入.将查看代码更改为

File inputs are not sent in the request unless your form element contains the enctype = "multipart/form-data" attribute. Change the view code to

@using (Html.BeginForm("Create", "User", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    ....
}