form.find("input[type='file']").on("change", function () {
if (this.files && this.files[0]) {
var FR = new FileReader();
FR.onload = function () {
previewElement.attr('src', FR.result);
};
FR.readAsDataURL(this.files[0]);
}
});
http://www.javascripture.com/FileReader
const reader = new FileReader();
reader.addEventListener('load', function (e) {
document.querySelector('.photo-image').setAttribute('src', reader.result);
}, false);
reader.readAsDataURL(file);