title: Unable to read data from multiple files using HTML FileReader
body: <pre><code>&lt;input type="file" id="input" multiple onchange="handleFiles(event.target)"&gt;
  &lt;script language="javascript" type="text/javascript"&gt;
       &lt;!--
  
       function handleFiles(input)
       {
            for (i = 0; i &lt; input.files.length; i++)
            {
                var reader = new FileReader();
                reader.onload = function() 
                {
                    alert(reader.result)
                };
                reader.readAsText(input.files[i]);
            }
        }
  
       //--&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>I am trying to display the contents of some files that I upload. It works fine if I select a single file, but if I select multiple files, only the content of one file is displayed, rest all are blank. What am I doing wrong?</p>