# \[Solved\]Pydio Cells REST API Adding Files

**URL:** <https://forum.pydio.com/t/solved-pydio-cells-rest-api-adding-files/2825>\
**Category:** Pydio Cells\
**Created:** [October 9, 2019, 6:53pm UTC](https://forum.pydio.com/t/solved-pydio-cells-rest-api-adding-files/2825 "2019-10-09T18:53:09Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![charles](https://yyz2.discourse-cdn.com/flex032/user_avatar/forum.pydio.com/charles/32/3_2.png) [@charles](https://forum.pydio.com/u/charles)\
**Post date:** [January 30, 2020, 8:08am UTC](https://forum.pydio.com/t/solved-pydio-cells-rest-api-adding-files/2825/8 "2020-01-30T08:08:03Z")

</div>

Arf, i’v been quietly forgotting my PHP skills for a while now 🙂

I think you may have to write something similar to :

```
// open a file for writing (or a target stream)
$destStream = fopen($filename, "w");
// get body as a stream
$body = $response->getBody();

// Copy-ing the body to the destination file
while (!$body->eof()) {
    $part = $body->read(4096);
    $readBytes = strlen($part);
    fwrite($destStream, $part, $readBytes);
}

// Close the target file
fclose($destStream)
```

---

_[View the full topic](https://forum.pydio.com/t/solved-pydio-cells-rest-api-adding-files/2825)._
