image validation in jquery – How to validate image file in JavaScript?

image validation in jquery – jQuery to Show Image Preview after Validating Image Size and Type Before Upload in jquery Example with demo.

image validation in jquery

Validation of file size while uploading using JavaScript / jQuery. File upload size validation using jQuery with demo. Upload image with validation using jquery ajax form plugin.

File upload size validation using jQuery with demo


Check File Size & Extension Before Uploading Using jQuery

The HTML Code

The jQuery

$('input[type="submit"]').prop("disabled", true);
var a=0;
//binds to onchange event of your input field
$('#dpImg').bind('change', function() {
if ($('input:submit').attr('disabled',false)){
var ext = $('#dpImg').val().split('.').pop().toLowerCase();
if ($.inArray(ext, ['gif','png','jpg','jpeg']) == -1){
	var picsize = (this.files[0].size);
	if (picsize > 1000000){
	if (a==1){

jQuery validate file type before upload

I hope you get an idea about image validation in jquery.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment