I start with Javascript and try to understand some basics. The questions concern not only the File interface, but also what I'm trying to figure out.
In my HTML file, I have a file type input.
<input type="file" id="fileInput" multiple/>
Then in my JS file I have:
var fileVar = document.getElementById('fileInput').files[0];
This works fine, and the file type is File .
Now I'm trying to understand how the files attribute works.
In W3, an API is defined as:
interface FileList { getter File? item(unsigned long index); readonly attribute unsigned long length; };
I am trying to figure out how I can access a single file in a FileList using files . It seems to be undefined anywhere. Where does the files array come from?
source share