When I upload an asset I get an alert window stating my file size is to large. I have increased the file size in the general.php config file larger than the file size, however I keep getting a error. We are using AmazonS3. Is Craft limiting the file size, PHP or AmazonS3?
6 Answers
It's most likely PHP. Most PHP installations come standard with a 2M limit.
Check out this Stack Overflow thread for more information on what needs to be adjusted.
-
1It was indeed PHP. Does Craft's "maxUploadFileSize" work on top of PHP's?– a-amCommented Jun 25, 2014 at 22:05
-
2Yes, it appears so. Per Brad's answer: "... Craft's own maxUploadFileSize config setting, which we default to 16MB." Commented Jun 25, 2014 at 22:28
Craft itself, limits the filesize only in the maxUploadFileSize
. Default: 16MB
However Craft gets limited by:
PHP: Has a few values which might cause the problem:
AmazonS3: If not limited by a policy
value, the default is 5GB.
User: Sometimes it can be just a Browser issue causing the problem.
-
So if you upload a file go S3... PHP MaxUploadFileSize, Memory Limit, Max_Input_Time and Post_max_Size dont count? You can upload up to 5GB? Commented Dec 3, 2014 at 14:36
-
@JohannesLamers, I'm curious to that as well. Did you find the answer to your question?– ForzaCommented Oct 28, 2019 at 12:17
It's almost always an environmental limitation. The most common culprits are:
PHP's memory_limit setting: https://www.php.net/manual/en/ini.core.php#ini.memory-limit
PHP's post_max_size: https://www.php.net/manual/en/ini.core.php#ini.post-max-size
PHP's upload_max_filesize https://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize
These default values vary per host/installation, but try increasing them in your php.ini file. You may or may not need to restart your web server in order for the new settings to take affect.
For your specific case, if those aren't the culprit, then I'd check either S3's upload limitation settings or Craft's own maxUploadFileSize config setting, which we default to 16MB.
For anyone else interested my issue was not the PHP limit but a limitation of NGINX, there is a setting which needs increased from the default value to allow uploading of larger files, client_max_body_size.
Keep in mind that f you're running a multi-environment config, and have configured your local environment (i.e. craft.dev) to point to a remote database, you'll need to make any php.ini changes on your local machine.
You can find the location of your php.ini file with php --ini
.
I had the same issue but I had to update the settings in Plesk, as rules being set elsewhere were being ignored. Someone may have a similar set up to me, and this will save them a few minutes of head-bashing.