show image onAfterSave

Hi guys so i’m trying to display an image that has been saved to a collection using write only and then display that image from a second collection using read only. (to begin with)

I have used the following tutorial to assist

I have the following on my page. a normal file upload button and an image of the upload button that i’m hoping will display the recently uploaded image to the write only file collection

I’m trying to achieve exactly the same functionality as the file upload within this forum i.e. the image displays straight away select (as below)

The code i have used so far is as follows. Dataset1 is write only, Dataset2 is read only.

I know this tutorial was for text based uploads so help is very much appreciated, which is probably why there are errors in my code.

also this tutorial video, doesn’t show the submit button being connected to the database within the editor.

import wixData from ‘wix-data’;

function getdata(){
letquery = wixdata.query(‘#dataset1’);
return query.limit(1000).find().then(results => {
return results.items;

$w.onReady( () => {
$w(‘#dataset2’).onAfterSave( () => {
getdata().((items) => {
$w(‘#image22’).data = items;


Hi guys,

so i don’t know if this code is workable. I found it from another member of wix however no body posted a reply to that person

export function uploadButton1_change(event) {
$w(" #uploadButton1 “).startUpload().then((uploadedFile) => {
let toInsert = {
“title”: $w(” #text23 ").text,
“image”: uploadedFile.url,

wixData.insert(“Portfolio”, toInsert)
.then(() => {
$w(’ #dataset2 ').refresh( );

if this code looks good it would be great if someone could explain why it works, line by line or even better make a short video :slight_smile: