title: FileUpload: Get filenames with JS not working
body: <p>I want to get filenames and put it in label <code>lbName</code> but this code is not working. I used <code>asp:FileUpload</code>. This is my code:</p>
  <p><code>&lt;asp:FileUpload ID=&quot;FileUpload1&quot; AllowMultiple=&quot;true&quot; runat=&quot;server&quot; Onchange=&quot;upload()&quot;/&gt;                      &lt;asp:Label ID=&quot;lbName&quot; runat=&quot;server&quot; ForeColor=&quot;Gray&quot; Visible=&quot;True&quot;&gt;&lt;/asp:Label&gt;</code></p>
  <p>and JS code:</p>
  <pre><code>function upload() {
      var name = &quot;&quot;;
  
      var files = document.getElementById(&quot;&lt;%= FileUpload1.ClientID %&gt;&quot;);
      for (var i = 0; i &lt; files.length; i++) {
          name = name + (files[i].name) + &quot;;&quot;;
      }
      document.getElementById(&quot;lbName&quot;).value = &quot;1: &quot; + name;
  }
  </code></pre>