Hello.
I am trying to save an uploaded document to a collection.
First I get values from the collection and show them on a page. I have no problem with that. Then, besides updating some text fields, I also want to update a field for uploaded files in collection. I have to submit the data with code for some reason. I used the line below for saving uploaded files. When I click the button all the fields are updated, but in collection for the field for uploaded files (of which the field name is ‘document’) it displays this warning: “Cell value type is JS Object.” . It does not save the document.
“files”: $w(‘#uploadButton1’).startUpload()
My whole code for updating the collection is like this:
export function button1_click(event, $w) {
let poz_kod = $w(‘#dropdown1’).value;
let toUpdate = {
“_id”: $w(‘#input1’).value,
“adi”: $w(‘#pozekletxtbox2’).value,
“seviye”: $w(‘#pozekletxtbox3’).value,
“aciklama”: $w(‘#pozekletxtbox4’).value,
“poz”: poz_kod,
“files”: $w(‘#uploadButton1’).startUpload()
};
wixData.update(“pozisyonlar”, toUpdate)
.then( (results) => {
let item = results;
} )
.catch( (err) => {
let errorMsg = err;
} );
}
Can you help me please?
Thanks in advance.