I am using Onedrive Rest API to Upload a file into my Onedrive Account. Below is the mentioned Microsoft documentation link to the Upload file.
Whenever I used the above API the file gets uploaded into my account but the file gets corrupted.
Below mentioned is my request object.
{
method: "PUT",
url: Upload Url,
processData: false,
headers: {
"Authorization": <access_token>
"Content-Disposition": 'form-data; name="metadata"',
"Content-Type": "application/json; charset=UTF-8",
"Content-Transfer-Encoding": "8bit"
},
formData: {
file: {
value: fs.createReadStream("Smile.png"),
options:
{
filename: "Smile.png,
contentType: null
}
}
}
}
The file gets uploaded in the proper folder but it's corrupted and I am unable to view it in my Onedrive Account. Can someone please help me with this.