When using a Submit Button in a form, the image is stored perfectly in the collection image field by just connecting the Upload Button to the dataset image field.
For certain reasons, I need to code the Insert. I have the same upload button with the same connection. The below code just store the filename uploaded by the user. I need to store the image itself.
_____________________________________________
let toInsert = { "image1": $w("#uploadButton1").value, } wixData.save("sellers", toInsert)
Hi,
I recommend checking out this article about How to Use the Upload Button with Code.
After using the startUpload function, it returns an object with a url field of the image uploaded:
$w("#uploadButton1").startUpload() .then( (uploadedFile) => { $w("#text1").text = "Upload successful"; $w("#image1").src = uploadedFile.url; })
You can save this URL to your collection.
Good luck,
Tal.