How to send file in Wix-fetch post call

I want to send the PDF file to SharePoint with SharePoint rest API. I am using wix-fetch to upload the file, the file is uploading to the SharePoint but not able to open that file on SharePoint it’s showing that file is either corrupted or not supported. I tried with many ways but not getting success.

Here is the code snippet


fetch( “https://bizinfotech.sharepoint.com/_api/web/GetFolderByServerRelativeUrl('” + filePath + “‘)/Files/add(overwrite=true, url=’” + newFileName + “')” , {
“method” : “post” ,
“headers” : {
“Accept” : “application/json” ,
“Authorization” : "Bearer " + token,
},
“body” : “{‘file’: '” + uploadFilePath + “'}”
})

I also tried to pass arrayBinary, Buffer in Body.

Hi,
I believe you need to pass the buffer and match the request with the sharePoint API, anyway, we do not provide support for 3rd party APIs.

hi, can u share full code ?