Edit
Maybe I'll try to break the issue into smaller ones:
- How to upload files from the same directory as index.html.
- How to upload a file into an element with
<input type="file">
by clicking on a button in another element. - How to customize the button from the second issue, which is probably easier once the first two issues are dealt with.
The original question
I'm trying to find a way to upload two files from code-provided paths into two elements with <input type="file">
attributes from a button of another element, so no dialog box for browsing files should be opened.
I couldn't find ways to do that. Maybe the issue phrasing was the reason. Maybe that's impossible. I don't have a lot of experience with HTML.
The files' elements code:
<input type="file" id="file1" name="file1" >
<textarea id="file1_txt" name="file1_txt" rows=8 cols=50></textarea>
<input type="file" id="file2" name="file2" >
<textarea id="file2_txt" name="file2_txt" rows=8 cols=50></textarea>
The other element's button code:
<button type="button" "style="color:red;font-weight:bold;height: 35px;font-size:14">Load example</button>
Thanks!