How do you preset the filepath in a input type=file?
I want the field to already have a path in it -> Read-Only possibly?
2 Answers 2
You can not preset the input[type=file] element.
The only reliable thing you can do is read back the filename with the value property on the DOM. Some browsers prepend a fake path, e.g. C:\fakepath\some-file.jpg.
Comments
You can't do that, it's a security issue. Doing so would let a web site operator create a form with a hidden file field, with a path filled in, so that when the user submits the form the browser would also upload a file of the website operator's choosing.