I am trying to select a specific file by clicking on another button.
This answer uses JavaScript and triggers the entry of the hidden file. The result can be seen here.
In my case, I already know the name of the file I want to select. I also know its directory.
Is there a way to pass this file name to a function? Something like document.getElementById('my_file').click(fname);
where fname = 'image/img.png'
.
Asked
Active
Viewed 23 times
0

Kyv
- 615
- 6
- 26
1 Answers
0
No. The only way is to open the file selection dialog and select the specific file. There's no way to tell it which file to select or from which directory to start.

Cjmarkham
- 9,484
- 5
- 48
- 81