Files become corrupt when trying to upload using REST API

I have setup discourse locally. I am trying to upload files using rest api.

here is the http headers and info from postman

POST /uploads.json HTTP/1.1
Host: localhost:4200
Api-Key: 3772adba123b1db43f4d3644382b97a5ba9b6cdfdb796e25341dc796c402638e
Api-Username: devarshmavani19
Cache-Control: no-cache
Postman-Token: 57530e28-fe64-a899-dfb3-80271a47ad31
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

Content-Disposition: form-data; name="type"

Content-Disposition: form-data; name="synchronous"

Content-Disposition: form-data; name="file"; filename="helloworld.pdf"


as shown the type is PDF and synchnouse is set to true.
but when i attach this file in post like this

[helloworld.pdf|attachment](upload://fechbEeCLVWfqlriiLsIKEu1wdg.pdf) (1.36 kb)

then i open up browser and click on the file download button and when i try to open it is is corrupted. I tried doing same with image but image is displayed correctly.
Have i missed anything please help.