Okay, man. And thank you. Here are the details for what I have:
On clicking my submit button (“#essavebutton”), I want the file I’ve selected to upload to replace the image file for a specific item in my dataset (selected by drop-down). If no file is selected, I want no change to occur for the image field in that item. The second part of my code works beautifully (the no-change part), but the upload part is not replacing the image file for the item selected.
Anything “e_xxx” is a global variable that is changed according to user input. My thinking is that upon upload, the new image’s “src” would be used to change my “e_flier” global variable src. Not sure why this isn’t working. I checked my Wix folders to see if my test image did indeed upload, but it hadn’t. I believe this is part of the problem. I am hoping you can help.
Here’s my code:
export function essavebutton_click(event) {
if ($w("#esimagebtn").value.length > 0) {
$w("#esimagebtn").startUpload()
.then( (uploadedFile) => {
e_flier = uploadedFile.url;
})
let toEvents = {
"title": e_title,
"_id": e_id,
"flier": e_flier,
"status": e_status,
"eventTitle": e_eventtitle,
"month": e_month,
"day": e_day,
"hr": e_hr,
"mn": e_mn,
"ampm": e_ampm,
"zone": e_zone,
"notes": e_notes
};
wixData.update("HLLES", toEvents);
} else {
let toEvents = {
"title": e_title,
"_id": e_id,
"flier": e_flier,
"status": e_status,
"eventTitle": e_eventtitle,
"month": e_month,
"day": e_day,
"hr": e_hr,
"mn": e_mn,
"ampm": e_ampm,
"zone": e_zone,
"notes": e_notes
};
wixData.update("HLLES", toEvents);
}
Looking forward to your insight, my man.
Thank you.