function filePreview (input) {
if(input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$('#uploadForm + img').remove();
$('#uploadForm').after('<img src="'+e.target.result+'" width="840" height="600" />');
}
reader.readAsDataURL(input.files[0]);
}
}
$('#fileThumbnail').change(function() {
filePreview(this);
});
I am trying to preview the image but only accept images if they are of width:840px, height:600px no more and no less. and return a error to select an image of those exact dimensions