ASP.NET MVC3 RAZOR: File Upload gives zero as file count

后端 未结 2 2006
庸人自扰
庸人自扰 2020-12-20 05:04

I need to upload multiple files into web server using MVC3 with RAZOR. I have the following code. In the controller, I am getting zero as the file count. How to correct it t

2条回答
  •  佛祖请我去吃肉
    2020-12-20 05:48

    You must include the enctype attribute in the form tag to indicate that the form should include files.

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

提交回复
热议问题