Here i have shown how to check the extensions of the file which are being browsed by the FileUpload control.
Introduction
In this small article, i have tried to show u, how to check the extension of a file which is being browsed by the FileUpload control.
Sometimes we may need to check the extension of the file browsed, in our client side only. Then we can use the following javascript function.
Javascript Function
OnClientClick event of the Button Control
Output
If a .jpeg/.bmp/.png file is selected, then the following output comes.
If a .doc/.docx file is selected, then the following output comes.
If no file is browsed, yet user clicks the button, then the following output comes.
Conclusion
Happy Coding!