# How to send a POST request with binary data as request body?

**URL:** <https://community.postman.com/t/how-to-send-a-post-request-with-binary-data-as-request-body/52776>\
**Category:** Help Hub\
**Tags:** tests, testscripts, pre-request-script, request-body\
**Created:** [October 4, 2023, 6:35am UTC](https://community.postman.com/t/how-to-send-a-post-request-with-binary-data-as-request-body/52776 "2023-10-04T06:35:38Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [October 4, 2023, 9:46am UTC](https://community.postman.com/t/how-to-send-a-post-request-with-binary-data-as-request-body/52776/3 "2023-10-04T09:46:15Z")

</div>

Is that jpeg confidential?

Are you ok with sending the jpeg to the Postman Echo service?

If you send the request as form data, it will return the base64 encoding.

For example…

![image](https://us1.discourse-cdn.com/getpostman/original/3X/d/1/d1ca6ab5f4ee4c0646d7a2bfb847df8ded7be714.png)

![image](https://us1.discourse-cdn.com/getpostman/original/3X/5/e/5e80ec7a64e31069e46e873b67809443d73df69c.png)

You can parse the response using something similar to the following to just return the base64 encoded string,

```auto
let response = pm.response.json(); 

let base64 = response.files["dog.jpg"].split(",")[1];

console.log(base64)

```

If you want to send this is a pre-request script then it will be similar but you will need to use the pm.sendRequest() function.

---

_[View the full topic](https://community.postman.com/t/how-to-send-a-post-request-with-binary-data-as-request-body/52776)._
