Use this component to fetch the image dynamically and display it in the Image widget.
How to use Upload and Display Profile Image Component :
____________________________________________________________________________________
Here's JavaScript code to display the uploaded image on screen:
$(function() {
$(".ImgUploader").on("change", function()
{
var files = !!this.files ? this.files : [];
if (!files.length || !window.FileReader) return; // no file selected, or no FileReader support
if (/^image/.test(files[0].type)) { // only image file
var reader_1 = new FileReader(); // instance of the FileReader
reader_1.readAsDataURL(files[0]); // read the local file
reader_1.onloadend = function() { // set image data as background of div
debugger;
$(".ImgPreview").attr("src", this.result);
}
});
New Update:
1. Updated Code as per Outsystems Best Practices.
2. Fixed AI Mentor Studio Findings.