just messing about trying to learn it. Im trying to validate an image from an upload. Checking the image type works fine with the code below. but im trying to check its size. Can anyone explain why this is not working please.
Thanks.
$('#File').change(function (evt) {
var f = evt.target.files[0];
var reader = new FileReader();
var H = f.height;
var W = f.width;
if (W > 100) {
alert("The selected file is too large.");
return;
}
if (!f.type.match('image.*')) {
alert("The selected file does not appear to be an image.");
return;
}
setBox('#IsFile');
reader.onload = function (e) { preview.attr('src', e.target.result); };
reader.readAsDataURL(f);
});