<p>When determining the maximum upload file size, Craft <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/variables/AppVariable.php#L209-L230" rel="noreferrer">first takes</a> the php.ini file <code>upload_max_filesize</code>, <code>post_max_size</code> and <code>memory_limit</code> into account by getting the minimum value and only then applying the Craft <a href="https://craftcms.com/docs/config-settings#maxUploadFileSize" rel="noreferrer"><code>maxUploadFileSize</code></a> config setting.</p>

CC BY-SA 4.0
2019-01-29T00:02:37.573Z
Is this still true for Craft 3? Does Craft always read the entire file into memory when uploading?
Simon East
CC BY-SA 4.0
2021-07-22T14:40:13.773Z
Yes. Just ran into this on a new site. memory_limit was set to 256, and that was the deciding factor in file size upload limit.
darylknight
CC BY-SA 3.0
2017-06-30T21:16:12.947Z
2017-06-30T21:16:12.947Z
Brad Bell
<p>Apparently, Craft requires <code>memory_limit</code> to also be set to max value, so setting <code>memory_limit</code> in <code>php.ini</code> did solve my problem.</p>

CC BY-SA 3.0
2017-06-30T19:10:40.980Z
2017-06-30T21:11:44.607Z
2017-06-30T21:11:44.607Z
Lukigi
<p>I have run into a problem of file sizes maxing out on 256MB.</p>

<p><strong>On PHP side I have</strong><br>
<code>upload_max_filesize</code> &amp; <code>post_max_size</code> set to <code>1GB</code></p>

<p>I've created a simple PHP script to test upload size and managed to upload 800MB file. So everything points to Craft having some limits.</p>

<p><strong>In Craft CMS config file I have:</strong></p>

<pre><code>'maxUploadFileSize'     =&gt; 1073741824
</code></pre>

<p>Yet if I try to upload files larger than 256MB I get a modal message saying file size exceeds 256MB.</p>

<assets><config><php><upload>
Upload file size limits to 256MB
# Upload file size limits to 256MB

(Asked by: username_0 on 2017-06-30)

I have run into a problem of file sizes maxing out on 256MB.
On PHP side I have
upload_max_filesize & post_max_size set to 1GB
I've created a simple PHP script to test upload size and managed to upload 800MB file. So everything points to Craft having some limits.
In Craft CMS config file I have:
'maxUploadFileSize'     => 1073741824

Yet if I try to upload files larger than 256MB I get a modal message saying file size exceeds 256MB.

**Tags:** assets, config, php, upload

---

## 2 answers

### Answer by username_1 on 2017-06-30. Score: 7

When determining the maximum upload file size, Craft [first takes](https://github.com/pixelandtonic/Craft-Release/blob/master/app/variables/AppVariable.php#L209-L230) the php.ini file `upload_max_filesize`, `post_max_size` and `memory_limit` into account by getting the minimum value and only then applying the Craft [`maxUploadFileSize`](https://craftcms.com/docs/config-settings#maxUploadFileSize) config setting.

> **Comments:**
> **username_2**: Is this still true for Craft 3? Does Craft always read the entire file into memory when uploading?  
> **username_3**: Yes. Just ran into this on a new site. memory_limit was set to 256, and that was the deciding factor in file size upload limit.  

---

### Answer by username_0 on 2017-06-30. Score: 3

Apparently, Craft requires `memory_limit` to also be set to max value, so setting `memory_limit` in `php.ini` did solve my problem.


---

