I have an image that I upload to the database every time I add an item. Is it possible to just click one button to automatically upload it?

Hi,

If the image that you are uploading is different for each item that is being added to the collection, you will have to use the upload button to select which image you would like to upload to the data collection. If the image resides in your computer, this is the way to get it to your data collection.

For more information on the UploadButton API, click here.

Best regards,
Edward | Corvid Team

Hi Edward, thank you for your anwer. This procedure is obvious, I use it every time I need to upload the image…
What I want is some kind of code where I could upload the image file automatically when clicking a button. Kind of (humor me, I’m not a Corvid expert :wink:
export function button1_onclick()
return wixData.query( “images” )
const toInsert = {
“image1” : image1,
};
// add the item to the collection
wixData.insert( “mandate/spot1” , toInsert)

I know this is all wrong but I want a specific button to use a specific image from a specific collection to insert it in another collection in a specific field.

I tried building a rolldown menu with 3 images to select and insert with a dataset, but it won’t take images. I also tried building a filter between two collections in a dataset, again images nor documents are compliant with this kind of procedure.

Am I clear or did I make it more complicated? LOL

Thanks in advance