Hi guys as above i’m looking to achieve uploading multiple images to a database and then display them on a gallery page, this is my code so far but it just inserts a long line of code to a single field! and not the separate images?
let workImages = [];
export async function uploadButton6_change(event) {
let greenFlag = false;
let file = $w('#uploadButton6').value;
if(file.length > 0){
let response = await $w('#uploadButton6').startUpload($w('#uploadButton6').buttonLabel = 'Uploading ...');
greenFlag = response;
if(greenFlag){
workImages.push(response.url);
greenFlag = false;
console.log(workImages, file[0].name);
$w('#uploadButton6').buttonLabel = 'Add another picture'
$w('#uploadedTxt').expand();
$w('#uploadedTxt').text = `Done, Uploaded ${file[0].name}`;
let user = wixUsers.currentUser;
let userId = $w('#id').text;
let values;
const allImages = (workImages);
wixData.query("MemberProfile")
.eq("_owner", userId)
.find()
.then((results) => {
values = results.items[0];
let allImages2 = allImages;
let items = results.items;
items.forEach((item) => {
item.traderWorkGallery = allImages2;
wixData.update("MemberProfile", item).then((results2) => {
$w('#gallery1').items = results2;
console.log(results2);
});
});
})
thanks in advance