# Multiple file upload

**URL:** <https://discourse.cakephp.org/t/multiple-file-upload/6179>\
**Category:** Need Help\
**Created:** [May 30, 2019, 11:59am UTC](https://discourse.cakephp.org/t/multiple-file-upload/6179 "2019-05-30T11:59:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dolando](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@Dolando](https://discourse.cakephp.org/u/Dolando)\
**Post date:** [May 30, 2019, 11:59am UTC](https://discourse.cakephp.org/t/multiple-file-upload/6179/1 "2019-05-30T11:59:32Z")

</div>

Hi

I would like to upload many images (up to 200) with one form.  
What is the best way to do that?  
I imagine to have a form for selecting the images on my local client side, and then loading the files up one by one. How can I do that?  
Would the [CakePHP Upload Plugin 3.0](https://cakephp-upload.readthedocs.io/en/latest/) be helpfull for that?  
I tried the normal way with XAMPP. It worked fine up to 19 images. With more than that, it didn’t work, $this-\>request-\>data is empty.  
I am using Cake 3.7.

Thank your very much for any helpful idea.  
Dorothee

---

<div class="post-metadata">

**Author:** ![Baku](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/baku/32/1416_2.png) [@Baku](https://discourse.cakephp.org/u/Baku)\
**Post date:** [May 30, 2019, 1:06pm UTC](https://discourse.cakephp.org/t/multiple-file-upload/6179/2 "2019-05-30T13:06:57Z")

</div>

First of all, welcome to cake php! also, did u try with examples of the documentation? also, most important of all, would u please share of your code, so that we need to see what’s the error happening with the upload. Have a good day!

---

<div class="post-metadata">

**Author:** ![deanoj](https://avatars.discourse-cdn.com/v4/letter/d/bcef8e/32.png) [@deanoj](https://discourse.cakephp.org/u/deanoj)\
**Post date:** [May 30, 2019, 1:22pm UTC](https://discourse.cakephp.org/t/multiple-file-upload/6179/3 "2019-05-30T13:22:36Z")

</div>

PHP limits the size of uploads and POST requests (post\_max\_size and upload\_max\_filesize I think). Sounds like 19 images come under that limit, adding more goes over that limit so is rejected.

Worth checking anyway.

---

<div class="post-metadata">

**Author:** ![Dolando](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@Dolando](https://discourse.cakephp.org/u/Dolando)\
**Post date:** [May 30, 2019, 7:09pm UTC](https://discourse.cakephp.org/t/multiple-file-upload/6179/4 "2019-05-30T19:09:54Z")

</div>

Thank you for your answers.

I set the post\_max\_size in the php.ini to 0M which means, the limit is disabled.  
That helped. Now I can upload 200 images!

Thank you very much, I am very happy.

Dorothee

---

<div class="post-metadata">

**Author:** ![FinlayDaG33k](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/finlaydag33k/32/1049_2.png) [@FinlayDaG33k](https://discourse.cakephp.org/u/FinlayDaG33k)\
**Post date:** [May 30, 2019, 8:54pm UTC](https://discourse.cakephp.org/t/multiple-file-upload/6179/5 "2019-05-30T20:54:33Z")

</div>

What you could do is use AJAX to send those files one by one.  
This way you can bump up the POST limit to like 100MB (which is already a _huge_ image) instead of 2GB.  
Doing this also allows you to continue uploading even if one file fails.

For an example of how I did this view these pieces of code:

- [https://gitlab.com/Werkwent/Kikioboeru/kikioboeru/blob/master/src/Template/Media/add.ctp](https://gitlab.com/Werkwent/Kikioboeru/kikioboeru/blob/master/src/Template/Media/add.ctp)
- [https://gitlab.com/Werkwent/Kikioboeru/kikioboeru/blob/master/src/Controller/MediaController.php#L62](https://gitlab.com/Werkwent/Kikioboeru/kikioboeru/blob/master/src/Controller/MediaController.php#L62)

---

<div class="post-metadata">

**Author:** ![Dolando](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@Dolando](https://discourse.cakephp.org/u/Dolando)\
**Post date:** [July 26, 2019, 9:04am UTC](https://discourse.cakephp.org/t/multiple-file-upload/6179/6 "2019-07-26T09:04:56Z")

</div>

Sounds like a very good idea! I will try this.  
Thank you ver much.  
Dorothee
