title: Reading multiple files with Javascript FileReader API one at a time
body: <p>I'm using the <strong>FileReader</strong> API to read multiple files.</p>
  
  <pre><code>&lt;html&gt; &lt;body&gt;
      &lt;input type="file" id="filesx" name="filesx[]"
        onchange="readmultifiles(this.files)" multiple=""/&gt;
      &lt;div id="bag"&gt;&lt;ul/&gt;&lt;/div&gt;
  &lt;script&gt;
  window.onload = function() {
      if (typeof window.FileReader !== 'function') {
          alert("The file API isn't supported on this browser yet.");
      }
  }
  
  function readmultifiles(files) {
      var ul = document.querySelector("#bag&gt;ul");
      while (ul.hasChildNodes()) {
          ul.removeChild(ul.firstChild);
      }
  
      function setup_reader(file) {
          var name = file.name;
          var reader = new FileReader();
          reader.onload = function(e) {
              var bin = e.target.result; //get file content
  
              // do sth with text
  
              var li = document.createElement("li");
              li.innerHTML = name;
              ul.appendChild(li);
          }
          reader.readAsBinaryString(file);
      }
  
      for (var i = 0; i &lt; files.length; i++) { setup_reader(files[i]); }
  }
  &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;
  </code></pre>
  
  <p>The problem is that all files are read at the same time, and when the files have a total size (sum) that is very large, the browser crashes.</p>
  
  <p>I want to read one file after another, so that the memory consumption is reduced.</p>
  
  <p>Is this possible?</p>