title: How FileReader.readAsText in HTML5 File API works?
body: <p>I wrote the following code to check whether the uploaded file exists or not using HTML5 file API.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="file" id="myfile"&gt;
  &lt;button type="button" onclick="addDoc()"&gt;Add Document&lt;/button&gt;
  &lt;p id="DisplayText"&gt;&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The following JavaScript code has been mapped to it is as follows:</p>
  
  <pre><code>function addDoc() {
    var file=document.getElementById("myFile").files[0]; //for input type=file
    var reader=new FileReader();
    reader.onload = function(e) {}
    reader.readAsText(file);
    var error = reader.error;
    var texte=reader.result;
    document.getElementById("DisplayText").innerText=reader.result; /*&lt;p id="DisplayText&gt;*/
  }
  </code></pre>
  
  <p>After browsing a file from local system I tried to delete the "browsed" document form the folder before clicking on <code>addDoc()</code>. After clicking the button I could still see <code>Filereader.result</code> is not null and could display all the content.</p>
  
  <p>Can someone explain on how the <em>Filereader</em> works? Is it that the <em>FileReader</em> gets bound as soon as the file is browsed?</p>
  
  <p>Also can we check whether the system <em>Readonly</em> Attribute with <em>FileReader</em> similar to Java <code>File.canread()</code>?</p>
  
  <p>Could someone suggest on this? I have IE11 to test the code.</p>