Javascript - Jquery to check file extension, Check the file extension while uploading
Jquery to check file extension
To check the file extension while uploading the file jquery can be used.
var imgext = $('#file_upload').val().split('.').pop().toLowerCase();
if($.inArray(imgext, ['jpeg','jpg']) == -1) {
alert('invalid extension!');
return false;
The above script will help you to check the file extension, while uploading files from client side. client side check will help to validate the forms. The above jquery script validates whether file is a jpg file or not. You can use the same script by changing the files extension and use it for validating different files while uploading.
The topic on Javascript - Jquery to check file extension is posted by - Math
Hope you have enjoyed, Javascript - Jquery to check file extensionThanks for your time