Onedrive Upload API uploads corrupt file or Image RRS feed

  • Question

  • Hi,

    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:Ppload 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"),
                filename: "Smile.png,
                contentType: null

    Can some one Please help me with this.

    Tuesday, November 5, 2019 3:09 PM