How to work with FileList (from <input type="file">) in Javascript?
<p>In <a href="http://www.w3schools.com/jsref/prop_fileupload_files.asp" rel="noreferrer">this W3schools example</a>, <code>console.log</code> on the input element reveals a FileInput object:</p>

<pre><code>FileList {0: File, 1: File, length: 2}
</code></pre>

<p>How can I work with this? The example demonstrates accessing the file, but every time a user selects new files, the old files disappear. How can I create a new empty FileList and copy it over, so that a user can add more files to the FileList?</p>

<p>I tried this, but it results in two FileList objects, rather than one FileList with all the files:</p>

<pre><code>var fileStore = x.files;

function myFunction(){
    var txt = "";
    if ('files' in x) {
        if (x.files.length == 0) {
            txt = "Select one or more files.";
        } else {
            fileStore += x.files;
            console.log(x.files);
            console.log(fileStore);
</code></pre>