Picture Upload saving to dataset

I have a form that intakes picture upload and few other user inputs. I have written a custom function on Submit button’s click to validate the form fields and then insert the data into dataset.

I have used wixData.insert to add values to dataset. After the data insertion, I dont see the picture reference for Upload column in dataset. On mouseover it shows a message as "Cell value type is JS Object. Change to Image "

Code used:

export function button1_click(event, $w) {
let getDataValues = {
“firstName”: $w(“#firstName”).value,
“lastName”: $w(“#lastName”).value,
“address”: $w(“#address”).value,
“paintingPicture”: $w(“#paintingUpload”).value,
};
wixData.insert(“Paintings”, getDataValues)
}

What should I use instead of .value for the picture upload field to insert in dataset?

1 Like

.src

Read through the API list to learn how to write code for specific elements

http://www.wix.com/code/reference/

Nayeli

.src is used to get or set the Image location. Am looking how do I save the image in dataset. In the below code
“paintingPicture”: $w(" #paintingUpload ").value,
the object is stored in dataset rather than the image.

Hi,
You can use the upload butotn. Check out this aticle. I found also this video tutorial which can be useful.

Good luck!
Tal.