# How do I download the binary file?

**URL:** https://community.dreamfactory.com/t/how-do-i-download-the-binary-file/4057
**Category:** uncategorized
**Created:** [September 16, 2017, 2:01pm UTC](https://community.dreamfactory.com/t/how-do-i-download-the-binary-file/4057 "2017-09-16T14:01:26Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![IvanOoi](https://avatars.discourse-cdn.com/v4/letter/i/74df32/32.png) [@IvanOoi](https://community.dreamfactory.com/u/IvanOoi)
#### Post date: [September 16, 2017, 2:01pm UTC](https://community.dreamfactory.com/t/how-do-i-download-the-binary-file/4057/1 "2017-09-16T14:01:27Z")

</div>

This is the setting.  
but…how do I download the binary from here? as the server return json as at bellow :

HttpResponseProxy{HTTP/1.1 201 Created [Date: Sat, 16 Sep 2017 13:54:59 GMT, Server: Apache, X-Frame-Options: SAMEORIGIN, Vary: Cookie, X-Powered-By: PHP/7.0.22, Cache-Control: no-cache, private, Content-Length: 87, Keep-Alive: timeout=5, max=99, Connection: Keep-Alive, Content-Type: application/json] ResponseEntityProxy{[Content-Type: application/json,Content-Length: 87,Chunked: false]}}

and this is my code :

```
    post = new HttpPost("http://localhost:8080/api/v2/files/5_6116365761188462595.docx?download=true");     

    post.setHeader("Content-Type", "application/docx");
    post.setHeader("Content-Disposition", "attachment; filename=5_6116365761188462595.docx");        
    post.setHeader("X-DreamFactory-Session-Token", ls_token );
    post.setHeader("X-Dreamfactory-API-Key", "36fda24fe5588fa4285ac6c6c2fdfbdb6b6bc9834699774c9bf777f706d05a88"); 
    
    paramList = new ArrayList<>();
    
    try {
    	post.setEntity(new UrlEncodedFormEntity(paramList));
    	
    	response = httpclient.execute(post);
    	
    	System.out.println(response.toString());

```

this is my dreamfactory setting :

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/2X/5/53235204b41dc4f1890dd3f986edaf2e683cb170.png)

---

<div class="post-metadata">

### Author: ![IvanOoi](https://avatars.discourse-cdn.com/v4/letter/i/74df32/32.png) [@IvanOoi](https://community.dreamfactory.com/u/IvanOoi)
#### Post date: [September 19, 2017, 2:41pm UTC](https://community.dreamfactory.com/t/how-do-i-download-the-binary-file/4057/2 "2017-09-19T14:41:12Z")

</div>

ok, finally I solved the problem. Apache HttpClient will not work. OKHTTP or Retrofit work fine.

Please note that Apache HttpClient will cause deamfactory reset the binary file to zero byte
