How to set a value to a file input in HTML?

前端 未结 8 1946
天命终不由人
天命终不由人 2020-11-21 04:45

How can I set the value of this?


8条回答
  •  花落未央
    2020-11-21 05:32

    1) The problem of default value in a file input IS NOT "done for security reasons", but the browsers "just failed to implement it, for no good reason": see this deep report

    2) A simple solution can be to use a text input on top of file input, like here. Of course you need some code to send the file, using now the value in text input and not the file input.

    In my case, doing HTA application, that is not a problem, I don't use form at all.

提交回复
热议问题