Looking up information on the Internet, it seems that it is impossible to directly call the click event through js statements to open the file selection dialog box because of security considerations.
However, you can open the file selection dialog box by binding the click event to other elements and calling the click event at the same time. Why is this?
The code is as follows:
https://jsfiddle.net/xavierskip/vnYVB/88/
Yes, because of security reasons, it is not possible to directly use js to call input type=file to open the file selection dialog box
But you can open it by calling other click events.As long as the incident is man-made.
In fact, there should be no reason for this. The organization that formulates the js standard is so decided.
For example, writing a script and opening the dialog box of selecting files all the time, the user thought he was poisoned.