Skip to content
Advertisement

FileUpload: Get filenames with JS not working

I want to get filenames and put it in label lbName but this code is not working. I used asp:FileUpload. This is my code:

<asp:FileUpload ID="FileUpload1" AllowMultiple="true" runat="server" Onchange="upload()"/> <asp:Label ID="lbName" runat="server" ForeColor="Gray" Visible="True"></asp:Label>

and JS code:

JavaScript

Advertisement

Answer

You could use jQuery and bind a change event to the input type=file.

JavaScript

Or if you want to make your javascript work:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement