How to keep input type=file field value after failed validation in ASP.NET MVC?

前端 未结 7 1807
闹比i
闹比i 2020-11-27 04:39

I\'ve got a simple form in an MVC app I\'ve made. It contains a file field so users can upload an image. It all works great.

Problem is, if the form submit fails val

7条回答
  •  無奈伤痛
    2020-11-27 04:54

    I would recommend doing the validation beforehand via ajax and do a partial page update. In this case, you will not lose the file.

提交回复
热议问题