# How to upload multiple Files with getUploadedFiles()

**URL:** <https://discourse.slimframework.com/t/how-to-upload-multiple-files-with-getuploadedfiles/1055>\
**Category:** Questions\
**Created:** [January 5, 2017, 11:47pm UTC](https://discourse.slimframework.com/t/how-to-upload-multiple-files-with-getuploadedfiles/1055 "2017-01-05T23:47:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![josvan](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@josvan](https://discourse.slimframework.com/u/josvan)\
**Post date:** [January 5, 2017, 11:47pm UTC](https://discourse.slimframework.com/t/how-to-upload-multiple-files-with-getuploadedfiles/1055/1 "2017-01-05T23:47:09Z")

</div>

Hi

I’m trying to upload multiple files but I see that getUploadedFiles() only gets one file.

This is my code:

```
 $files = $request->getUploadedFiles();

 var_dump($files);
 die();

```

And I’m using Postman like this example ([https://i.stack.imgur.com/kAIrb.png](https://i.stack.imgur.com/kAIrb.png)) and choosing several files

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![martisj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/martisj/32/317_2.png) [@martisj](https://discourse.slimframework.com/u/martisj)\
**Post date:** [May 10, 2017, 10:05am UTC](https://discourse.slimframework.com/t/how-to-upload-multiple-files-with-getuploadedfiles/1055/2 "2017-05-10T10:05:11Z")

</div>

Hi @josvan did you figure this out?

---

<div class="post-metadata">

**Author:** ![Jozef94](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@Jozef94](https://discourse.slimframework.com/u/Jozef94)\
**Post date:** [June 15, 2017, 11:20am UTC](https://discourse.slimframework.com/t/how-to-upload-multiple-files-with-getuploadedfiles/1055/3 "2017-06-15T11:20:47Z")

</div>

Same thing was happening to me when i had input set like this:  
`<input type="file" name="gallery" multiple="multiple">`  
fix was to add “[]” behind name:  
`<input type="file" name="gallery[]" multiple="multiple">`

now getUploadedFiles() shows more than one file,  
hope it helps somebody 🙂

---

<div class="post-metadata">

**Author:** ![datovard](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@datovard](https://discourse.slimframework.com/u/datovard)\
**Post date:** [January 7, 2018, 1:19am UTC](https://discourse.slimframework.com/t/how-to-upload-multiple-files-with-getuploadedfiles/1055/4 "2018-01-07T01:19:38Z")

</div>

You have to set the Content-type of the message as multipart/form-data
