When we need to Upload any file in to our system we need the
Browse and Upload action. In the case of Windows application of .NET there is a
control called OpenFileDialog which is used for Uploading any file with
browsing. Here we can get the file filter action by using the Filter property.
For example, we have to Upload only the test files into our system, so we can
set the filtering action as: (OpenFileDialog)Object.Filter = "Text files|*.txt;
*.doc; *.rtf" in Windows Application of .NET.
So, when windows developers need this type of filtering
action in Web Application, they have a option of using asp:FileUpload control
of ASP.NET. Unfortunately, we which have no such property to set a filter for
doing the file filtering action before Uploading. So we need to develop our own
logic to achieve our Objective.
To get the filtering action we have two options in Web Application:
Client side action and Server side action. In this article we will discuss
both the possible ways with a step-by-step example to add the file filtering
logic in our application.