Whenever we use
fileupload control on web pages, the common requirement is to validate its file type and size.
The above code explains itself a lot so there is no need to discuss further on it.
Here is the HTML markup that shows controls on the page:
<form id="form1" runat="server">
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Upload"
OnClientClick="return FileTypeValidate();" />
This is a very simple, but very common scenario for the web applications & very effective if managed properly…
That's it, hope this will help !!!