I set up a gallery connected to a database media gallery. Coded an upload button to push images to the gallery and then save to the database. It works, but when I open the images as the site ADMIN and close the galley window the images disappear leaving only a remnant of an image that used to be there. Here is my code-
export function uploadButton4_change(event) { $w("#uploadButton4").startUpload() .then((uploadedFile) => { let url = uploadedFile.url; let items = $w("#gallery1").items; items.push({ "src": uploadedFile.url, "description": "", "title": "" }); $w("#gallery1").items = items; $w("#uploadButton4").reset(); }) .then(() => { let items = $w('#gallery1').items; $w('#dataset1').setFieldValue("image2", items); $w("#dataset1").save(); $w('#dataset1').refresh(); }) .catch((uploadError) => { let errCode = uploadError.errorCode; let errDesc = uploadError.errorDescription; }); }
Initial View
![](https://static.wixstatic.com/media/a27d24_e5184305a13449aa841fac548844d20c~mv2.png/v1/fill/w_50,h_38,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/a27d24_e5184305a13449aa841fac548844d20c~mv2.png)
When I open the gallery
![](https://static.wixstatic.com/media/a27d24_86669edae4b64fba8d12c999bb46b8cf~mv2.png/v1/fill/w_49,h_32,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/a27d24_86669edae4b64fba8d12c999bb46b8cf~mv2.png)
After I click done when viewing
![](https://static.wixstatic.com/media/a27d24_cd5767743b2640e7b90e81a321007f2e~mv2.png/v1/fill/w_50,h_38,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/a27d24_cd5767743b2640e7b90e81a321007f2e~mv2.png)
Then when I open it again
![](https://static.wixstatic.com/media/a27d24_08055ead2351497a9b9cfc47951ab971~mv2.png/v1/fill/w_49,h_32,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/a27d24_08055ead2351497a9b9cfc47951ab971~mv2.png)
What the heck is happening to the images?
The only thing that I see is odd is that every time an image is uploaded a new entry is put in the database. This may cause odd behavior but i'm not sure if that's your problem.
website link if it helps
lvlsocial.com