Introduction
In this article we will learn how to restrict users to upload the files of
specific type through FileUpload control by validating through
RegularExpressionValidator validation control.
Description: Sometimes it is required to validate the file extension before uploading the file i.e. you want that user can upload only the files of specific extension e.g. if you want the user can upload only Word and Excel files(.doc, .docx, .xls, .xlsx ) then you have to check the extension of the file the user is going to upload. Similarly if you want only images of the type (.png, .jpg, .jpeg, .bmp or.gif) can be uploaded then it is also possible.
Description: Sometimes it is required to validate the file extension before uploading the file i.e. you want that user can upload only the files of specific extension e.g. if you want the user can upload only Word and Excel files(.doc, .docx, .xls, .xlsx ) then you have to check the extension of the file the user is going to upload. Similarly if you want only images of the type (.png, .jpg, .jpeg, .bmp or.gif) can be uploaded then it is also possible.