diff options
Diffstat (limited to 'resources/assets/js/profile.js')
-rw-r--r-- | resources/assets/js/profile.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/resources/assets/js/profile.js b/resources/assets/js/profile.js new file mode 100644 index 0000000..bce94da --- /dev/null +++ b/resources/assets/js/profile.js @@ -0,0 +1,13 @@ +$("#avatarFile").on("change", () => { + var preview = document.querySelector('#image-preview'); + var file = document.querySelector("#avatarFile").files[0]; + var reader = new FileReader(); + + reader.addEventListener("load", () => { + preview.src = reader.result; + }, false); + + if (file) { + reader.readAsDataURL(file); + } +});
\ No newline at end of file |