use onload

master
Aevann 2023-08-07 14:58:06 +03:00
parent 2ebba2de49
commit a29191c517
1 changed files with 2 additions and 2 deletions

View File

@ -530,10 +530,10 @@ if (file_upload) {
if (filename.toLowerCase().endsWith(s)) {
const fileReader = new FileReader();
fileReader.readAsDataURL(file_upload.files[0]);
fileReader.addEventListener("load", function () {
fileReader.onload = function () {
document.getElementById('image-preview').setAttribute('src', this.result);
document.getElementById('image-preview').classList.remove('d-none');
});
};
break;
}
}