Check File Size & Extension Before Uploading Using jQuery


HTML CSS PHP Tutorials

One of the most common validation which you may need to implement is to check the file size and file extension before upload the file, i made this simple tutorial to validate the image file size (MAX 1 MB)  and file extension, i used here (JPG, JPEG, PNG or GIF) extensions are valid for our image file using jQuery. Submit button will remain disable until valid input is not provided.

Note: Don’t forget to include the jQuery library in the header or footer.

Demo:  https://jsfiddle.net/javedfiddle/707pww2o/

Check-File-Size-Extension

HTML

JavaScript

Add the above JavaScript in your footer or header but recommended in footer.

Complete Webpage

Leave your comments if you find this tutorial helpful.

View original post