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

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

How can I set the value of this?


8条回答
  •  不思量自难忘°
    2020-11-21 05:24

    You can't.

    The only way to set the value of a file input is by the user to select a file.

    This is done for security reasons. Otherwise you would be able to create a JavaScript that automatically uploads a specific file from the client's computer.

提交回复
热议问题