Request.Files.Count always 0 while uploading image in MVC 5

前端 未结 1 965
情书的邮戳
情书的邮戳 2021-02-12 05:48

I have a Post controller on a model with some string fields and an image. Exact identical code works on MVC4 but in MVC 5 the Request.Files.Count is always 0

My model ha

相关标签:
1条回答
  • 2021-02-12 06:22

    I wasted so much time and it turns out that all I needed to do was to use the name attribute as well

     <input type="file" name="somename"> 
    

    the name attribute was missing in my new project.

    0 讨论(0)
提交回复
热议问题