Fill in input file form with JavaScript

Note:

Below is an answer that reflects the status of outdated browsers in 2009. Now you can really set the value of the file input element dynamically / programmatically using JavaScript in 2017.

See the answer in this question for details, as well as a demo:
How to set file input value programmatically (for example: when dragging and dropping files)?

I need to fill out an HTML JavaScript form to specify a file path for loading it. The web to which this form belongs already has a visual download, but

<form id="mobile_fileform"> <input type="file" style="height: 20px; width: 0px; opacity: 0; " id="mobile_fileselect1" multiple="" size="-17"> <input type="file" style="height: 20px; width: 0px; opacity: 0; " id="mobile_fileselect2" multiple="" size="-17"> <input type="file" style="height: 20px; width: 0px; opacity: 0; " id="mobile_fileselect3" multiple="" size="-17"> </form> 

How to set the file path in this form and how to load it using JavaScript?

thanks for the help

+6
source share
1 answer

Property value input:file for <security considerations> read-only . If you want to install it, you need to do it on the server side.

As a result, you are asking to do impossible . Think about the consequences: any web page will be able to download any file from some computer if they know the path.

+7
source

All Articles