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:

  1. 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 ...

Get HTML5 Data and Services Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.