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

前端 未结 7 1819
闹比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:45

    Browsers are designed in such way because of security risks. It's impossible to set value of file input box in HTML source or by Javascript. Otherwise malicious script could steal some private file without user attention.

    There is an interesting information about the subject.

提交回复
热议问题