function readImage (file) { var reader = new FileReader(); reader.addEventListener("load", function (e) { $(".guide-fu-fileItemList").hide(); var image = new Image(); $(".photo-upload .preview .imageP").remove(); $(".photo-upload .preview .text").remove(); image.width = 170;image.height = 220; image.className = "imageP"; image.addEventListener("load", function () { $(".photo-upload .preview")[0].prepend(this); AFBBindedImage.value = e.target.result.substr(23); }); image.src = window.URL.createObjectURL(file); }); reader.readAsDataURL(file); } readImage($(this.fileList[0])[0].files[0]);