I need to upload an image from multiple upload buttons to a database via let toInsert.
I’ve had a little help and this is where I’m up to, but it’s not working. I also need to be able to add more upload button code stuff in. Here’s the code for now:
function saveProperties() {
$w('#buttonSubmit').disable()
let uniqueClicks = 0
let user = wixUsers.currentUser;
let userId = user.id;
let familyPic1;
$w("#uploadButton13").startUpload()
.then((uploadedFile) => {
let url = uploadedFile.url;
})
let toInsert = {
"industry2": $w("#checkboxGroup1").value,
"title": $w("#input2").value,
"agentEmail": $w("#input3").value,
"mapLocation": $w("#input36").value,
"businessWebsite": $w("#input35").value,
"facebook": $w("#input33").value,
"instagramLink": $w("#input34").value,
"hoursOfOperation": $w("#input37").value,
"description": $w("#richTextBox1").value,
"familyPic1": familyPic1,
"amenities": $w("#selectionTags1").value,
"uniqueClick": uniqueClicks,
"_userId": userId
};
wixData.insert("Properties", toInsert)
.then ((results) => {
let item = results;
console.log(item);
$w("#textErr").text = "Your information has been submitted"
$w("#textErr").show().then(() => {
$w("#buttonSubmit").enable()
setTimeout(() => {
$w("#textErr").hide()
wixLocation.to("/update-pics-and-links");
}, 5000
)
})
})
.catch((err) => {
let errorMsg = err;
console.log(errorMsg)
});
}
I think it’s the final hurdle in this part of my project and any help would be appreciated. (To think this time last week the best I could code was showing and hiding on a click event)