# Upload large file failed with : CSRF error. Small file is OK

**URL:** <https://discourse.cakephp.org/t/upload-large-file-failed-with-csrf-error-small-file-is-ok/11383>\
**Category:** Uncategorized\
**Created:** [July 21, 2023, 10:37am UTC](https://discourse.cakephp.org/t/upload-large-file-failed-with-csrf-error-small-file-is-ok/11383 "2023-07-21T10:37:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![general2000vn](https://avatars.discourse-cdn.com/v4/letter/g/a87d85/32.png) [@general2000vn](https://discourse.cakephp.org/u/general2000vn)\
**Post date:** [July 21, 2023, 10:37am UTC](https://discourse.cakephp.org/t/upload-large-file-failed-with-csrf-error-small-file-is-ok/11383/1 "2023-07-21T10:37:46Z")

</div>

I am using CakePHP 4.2, and Upload plugin.

The app can upload small files OK, but when I upload 30 MB file, it failed and gives error message: `CSRF token from either the request body or request headers did not match or is missing`

Is there anything to do with multi-part form upload?  
How to fix this ?

Thank you very much

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [July 21, 2023, 4:41pm UTC](https://discourse.cakephp.org/t/upload-large-file-failed-with-csrf-error-small-file-is-ok/11383/2 "2023-07-21T16:41:48Z")

</div>

What are your `post_max_size` and `upload_max_filesize` ini values?

---

<div class="post-metadata">

**Author:** ![general2000vn](https://avatars.discourse-cdn.com/v4/letter/g/a87d85/32.png) [@general2000vn](https://discourse.cakephp.org/u/general2000vn)\
**Post date:** [July 22, 2023, 3:03am UTC](https://discourse.cakephp.org/t/upload-large-file-failed-with-csrf-error-small-file-is-ok/11383/3 "2023-07-22T03:03:27Z")

</div>

Thank you very much Zuluru,

I did changed `Upload_max_filesize` to 512 MB, but forgot about the `post_max_size`. My bad.

It works fine now. Thanks again.
