For reading local files this guide here uses the following code:
function handleFileSelect(evt) {
var files = evt.target.files; // FileList object
...
and
<input type="file" multiple>
This works perfectly fine, but what if I want to access only a single file, because I am using the input file type without multiple. Is accessing the FileList arrays first index the only way?
var files = evt.target.files; // FileList object
var singleFile = files[0];
You will have to use the files[0] as you are accessing a FileList collection http://dev.w3.org/2006/webapi/FileAPI/#dfn-filelist
The other syntax you could use is
files.item(0)