I want to have input
tag for uploading multiple images.
I have format limitation in preview (called on change trigger) as below. How can I add another limitation for images greater than 100kb?
function previewPhotoInput() {
var $preview = $('#previewPhoto');
if (this.files) {
var files = this.files;
$.each(files, function (i, file) {
if (!/\.(jpeg|jpg)$/i.test(file.name)) {
return alert("Invalid Format!");
}
var reader = new FileReader();
$(reader).on("load", function () {
$preview.append($("<img/>", { src: this.result, height: 100 }));
});
reader.readAsDataURL(file);
});
}
}