Limit upload file size

Hi all,
I want to limit the file size every user can upload to 1GB.
I set in php.ini
post_max_size = 1G
upload_max_filesize = 1G

phpinfo() show me that I’m modifing the correct php.ini and I can see the values I set.

But this configuration doesn’t work and I can upload bigger files.

Any suggestion will be appreciated.
Thank you

Nextcloud version
Operating system and version Ubuntu 16.04:
Apache or nginx version Apache 2.4.18:
PHP version 7.0.15 FPM:

Here my config.php

$CONFIG = array (
  'instanceid' => 
  'passwordsalt' => 
  'secret' => 
  'trusted_domains' =>
  array (
    0 => '',
    1 => '',
  'datadirectory' => '/opt/data',
  'overwrite.cli.url' => '',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => 'quidrive',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => '',
  'mysql.utf8mb4' => true,
  'dbuser' => 'quidrive',
  'dbpassword' => ,
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'dbindex' => 0,
  'skeletondirectory' => '/home/httpd/quidrive/current/public/themes/quidrive/core/skeleton/',
  'theme' => 'quidrive',
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',

Did you try restarting Apache?

sudo service apache2 restart

I’m using php-fpm, so restarting apache is not useful.
Apache has Timeout set as max_execution_time (3600).

If still having issue would try restarting server anyways.

Same problem here!

Please help.


I also have the same problem on nextCloud 13. :neutral_face:

Yes, no news :sweat:

The Nextcloud sync client is not affected by these upload limits as it is uploading files in smaller chunks.

This is what I actually suspected…

After the workaround that involves splitting the upload source file into small chinks to bypass the php upload max size of 2GB on 32 bit OS’s, it seems the maximum upload limit is no longer applicable.

I am able to upload files over 2 GB on my Raspberry Pi Model 3B Plus, running Raspbian Stretch 9.4 (32 bit as all Raspbian distros) and Nextcloud 13.02 (stable), I tried with a 4.3 GB ISO file and it the SHA256 hash key of the uploaded file matched that of the source file.

Yet, regardless of the upload_max_filesize setting in the .htaccess/.user.ini/php.ini files, the limit is not applied…

I want to inquire if I would still have this issue while using a 64 bit OS, would the file “chunking” still be applied when uploading large files seeing how the 2GB limit is no longer present ?


Did you use the file-access-control app? This can normally limit the file size since the client wouldn’t see a webbrowser limit due to chunking (which is done to speed up the file transfer by allowing more parallel connections).

Regarding the webserver configuration, I have seen limitations and I don’t know why they shouldn’t apply. Since webserver and php are working together and you can set limits on either side, it’s not obvious where it fails. To analyse more in detail, I’d take a basic upload script (independent from Nextcloud) and try if the limits apply (to be sure the function as it is, works). Then you can try to figure out what Nextcloud is doing. I don’t know how much you can change settings within scripts (or how much you allow).