Document saves to Collection as text file

I am trying to save a document to a collection using code. When I go into the collection the code has saved it in javascript format.
[
{
“name”: “Intake Pretalk.docx”,
“size”: 25972,
“valid”: true,
“validationMessage”: “”
}
]
The Upload button code looks like this:

export function submitButton_click ( event ) {
$w . onReady ( function () {
$w ( “#Documents” ). setFieldValues ( {
“documentPdf” : $w ( ‘#documentUploader’ ). value ,
“documentImage” : $w ( ‘#ImageUploader’ ). value ,
});

$w ( “#Documents” ). save ()
});
}
Have I not changed a value somewhere that forces the upload button to use only docs or images. I have checked this. How do I save the actual document the visitor uploads (pdf, word, text etc) using code so I can view it later?

Please would someone be kind enough to help me.