# Uploading file using put

**URL:** <https://discourse.slimframework.com/t/uploading-file-using-put/1053>\
**Category:** Questions\
**Created:** [January 5, 2017, 8:36pm UTC](https://discourse.slimframework.com/t/uploading-file-using-put/1053 "2017-01-05T20:36:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashickur-noor](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/ashickur-noor/32/189_2.png) [@ashickur-noor](https://discourse.slimframework.com/u/ashickur-noor)\
**Post date:** [January 5, 2017, 8:36pm UTC](https://discourse.slimframework.com/t/uploading-file-using-put/1053/1 "2017-01-05T20:36:10Z")

</div>

I can successfully upload file using post method with the help of this post [https://akrabat.com/psr-7-file-uploads-in-slim-3/](https://akrabat.com/psr-7-file-uploads-in-slim-3/). But I am not getting any idea how to upload a file using put method. Is the any way to that in SLIM ?

---

<div class="post-metadata">

**Author:** ![akrabat](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/akrabat/32/9_2.png) [@akrabat](https://discourse.slimframework.com/u/akrabat)\
**Post date:** [January 6, 2017, 7:42am UTC](https://discourse.slimframework.com/t/uploading-file-using-put/1053/2 "2017-01-06T07:42:50Z")

</div>

In PHP, in terms of file uploads, PUT requests don’t work the same way as POST requests. That is, a PUT doesn’t result in the file’s data being available in `$_FILES`.

As such, you need to write your own handler reading the data in `$request->getBody()` directly.

---

<div class="post-metadata">

**Author:** ![diegoluisr](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/diegoluisr/32/244_2.png) [@diegoluisr](https://discourse.slimframework.com/u/diegoluisr)\
**Post date:** [January 9, 2017, 6:49pm UTC](https://discourse.slimframework.com/t/uploading-file-using-put/1053/3 "2017-01-09T18:49:22Z")

</div>

PUT is a method / verb used in Rest to partially modify a database record. Maybe, you have to take a look of this article before continue [https://martinfowler.com/articles/richardsonMaturityModel.html](https://martinfowler.com/articles/richardsonMaturityModel.html). I think this could clear some misconceptions

---

<div class="post-metadata">

**Author:** ![ashickur-noor](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/ashickur-noor/32/189_2.png) [@ashickur-noor](https://discourse.slimframework.com/u/ashickur-noor)\
**Post date:** [January 12, 2017, 6:26am UTC](https://discourse.slimframework.com/t/uploading-file-using-put/1053/4 "2017-01-12T06:26:41Z")

</div>

OK. What I have understand I will use post instead of put.
