I followed various examples and tutorials. After days of testing I was able to write a code that visually loads more images in a gallery on the page, but when I go to save the photos in the dbms, instead of recording them all in the gallery field of the database it writes them in a different field generating many record how many images.
Can anyone please tell me how can I fix it?
Thanks in advance as always
export function uploadgallery_change(event, $w) {
if ($w(“#gallery1”).items.length > 0) {
if ($w(“#gallery1”).items[0].title === “noImageUploadedImage”) {
let items = $w(“#gallery1”).items;
items.splice($w(“#gallery1”).items[0], 1);
$w(“#gallery1”).items = items;
}
}
$w(“#gallery1”).show();
let selectedFile = $w(“#uploadgallery”).value;
$w(“#textgallery”).hide();
$w(“#uploadgallery”).startUpload($w(“#uploadgallery”).buttonLabel = “In caricamento”)
.then((uploadedFile) => {
let uploadfileurl = uploadedFile.url;
let items = $w(“#gallery1”).items;
items.push({
“src”: uploadfileurl,
});
$w(“#gallery1”).items = items;
$w(“#uploadgallery”).reset();
$w(“#uploadgallery”).buttonLabel = “caricato”;
$w(“#deletebutton”).show();
wixData.insert(“test”, uploadedFile);
})
. catch ((uploadError) => {
console.log(Error: ${uploadError.errorCode}
);
$w(“#uploadgallery”).reset();
$w(“#uploadgallery”).buttonLabel = “caricamento”;
$w(“#textgallery”).text = “File non supportato”;
$w(“#textgallery”).show();
});
}