you can do this as am assuming a image and am checking the resolutions and then i disable or enable the button as per requirements and also am clearing selected
image so user can’t upload the wrong format .
<script>
var _URL = window.URL || window.webkitURL;
$("#file").change(function (e) {
var file, img;
if ((file = this.files[0])) {
img = new Image();
img.onload = function () {
//alert(this.width + " " + this.height);
var widthofimage = this.width;
var heightofimage = this.height;
if (widthofimage < 1920 && heightofimage < 850 || widthofimage != 1920 && heightofimage != 850 || widthofimage > 1920 && heightofimage > 850) {
swal({
title: "Please review",
text: "Please Upload Image of 1920 X 850",
icon: "error",
});
document.getElementById("file").value = "";
} else {
$('input[type="submit"]').removeAttr('disabled');
}
};
img.onerror = function () {
alert("not a valid file: " + file.type);
};
img.src = _URL.createObjectURL(file);
}
});
</script>
solved how to disable button on change using jquery