hello friends I’m trying to upload images and have them be seen in a gallery before saving to be able to edit and then upload
I tried this code but I can’t find a way to adapt it for a gallery
could any help me? thanks!
$w.onReady(function () {
let defaultImage = $w("#image").src;
$w("#uploadButton").onChange(() => {
if ($w("#uploadButton").value.length > 0) {
$w("#preloaderContainer").show();
// To prevent showing the previous image once a new one is uploaded
$w("#image").src="";
$w("#uploadButton").startUpload()
.then((uploadedFile) => {
$w("#image").src = uploadedFile.url;
})
.catch(err => {
console.log(err, "Something went wrong")
})
.finally(() => {
$w("#preloaderContainer").hide();
})
} else {
// If the user clicks X on the upload button, reset the image to the default one
$w("#image").src = defaultImage;
}
})
});