Upload Images while creating new Model

前端 未结 3 808
孤独总比滥情好
孤独总比滥情好 2020-12-21 10:50

I\'m going to create profile for my users in ASP.Net MVC application. Users creation controller is something like this:

[HttpPost]
[ValidateAntiForgeryToken]         


        
3条回答
  •  离开以前
    2020-12-21 11:12

    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" }))
    {
        ....
    }
    

提交回复
热议问题