Reading data from files
We have already used file input to read some of the data, but never went into details about file reading and the objects that are available to us. In this recipe, we will create a simple file reader using input file that will act as a mini demonstration of some of the options provided in the File API: Directories and System, http://www.w3.org/TR/file-system-api/.
How to do it...
We will create an HTML file containing a file input control and a progress output for the state of the upload:
We create the controls and a few output placeholders:
<body> <p> <progress id="progress" value="0" max="100"></progress> <output id="percent" for="progress">0</output> </p> <p> <div id="fileInfo"></div> </p> <input type="file" id="file" value="Choose text file"> <button type="button" id="abort">Abort</button> <button type="button" id="slice">Read 5 bytes</button> <div id="state"><...