Here is the code :
$fileinput1.on("change", function () {
var input = this;
var url = $(input).val();
var ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase();
if (input.files && input.files[0] && (ext == "png" || ext == "jpeg" || ext == "jpg")) {
var FR = new FileReader();
FR.onload = function (e) {
var imagetocheck = new Image();
imagetocheck.src = e.target.result;
imagetocheck.onload = function () {
var width = this.width;
var height = this.height;
if (width == 50 && height == 50) {
}
else {
alert('Invalid Dimensions - Only image with Height-50px and Width 50px is accepted !!');
}
};
};
FR.readAsDataURL(this.files[0]);
}
else {
alert('Invalid extension');
}
});
Comments
Post a Comment