Set file to input from JavaScript

0

I need to automate the way to select the file in an input. Adding it manually via JS.

I have this:

<input type="file" id="files" onchange='stl_viewer.add_model({local_file:this.files[0]});' multiple>

The idea is to pass the file through JS and the onchange to act.

Any ideas? I've been with it for a while and there's no way.

Thank you!

EDIT:

I have already been told that security is impossible. So, how can I pass the local address of a file to the [File Object] format?

That is, to pass a string to this type of object, since the script that I use will pass the file selecting from the input.

Can I do something like that to make it the same as if I had chosen it from input? this.files [0].

Thank you.

    
asked by Jose Gutierrez 17.10.2018 в 11:56
source

0 answers