Cant upload files bigger 512MB - Sabre\DAV\Exception\BadRequest: HTTP/1.1 400 expected filesize

Hey everyone!

I still have the problem, that I cannot upload any files bigger than 512MB.
I get this Error:

Some Information:

OS: Debian 8.6 x64
Nextcloud Version: 11.0.0
PHP Version: 5.6.27

The site is also HTTPS / SSL secured. No “server-side” encryption enabled tho.

What I configured in “/etc/apache2/sites-available/000-default.conf”:

<Directory "/var/www/html">
    AllowOverride All
    LimitRequestBody 2147483647
    SSLRenegBufferSize 10486000
</Directory>

Here my “.htaccess”:

<IfModule mod_headers.c>
  <IfModule mod_setenvif.c>
    <IfModule mod_fcgid.c>
       SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
       RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
    <IfModule mod_proxy_fcgi.c>
       SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
  </IfModule>

  <IfModule mod_env.c>
    # Add security and privacy related headers
    Header set X-Content-Type-Options "nosniff"
    Header set X-XSS-Protection "1; mode=block"
    Header set X-Robots-Tag "none"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-Download-Options "noopen"
    Header set X-Permitted-Cross-Domain-Policies "none"
    SetEnv modHeadersAvailable true
  </IfModule>

  # Add cache control for static resources
  <FilesMatch "\.(css|js|svg|gif)$">
    Header set Cache-Control "max-age=15778463"
  </FilesMatch>

  # Let browsers cache WOFF files for a week
  <FilesMatch "\.woff$">
    Header set Cache-Control "max-age=604800"
  </FilesMatch>
</IfModule>
<IfModule mod_php5.c>
  php_value upload_max_filesize 16G
  php_value post_max_size 16G
  php_value memory_limit 512M
  php_value mbstring.func_overload 0
  php_value always_populate_raw_post_data -1
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>
<IfModule mod_php7.c>
  php_value upload_max_filesize 16G
  php_value post_max_size 16G
  php_value memory_limit 512M
  php_value mbstring.func_overload 0
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
  RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  RewriteRule ^remote/(.*) remote.php [QSA,L]
  RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*
  RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>
<IfModule mod_mime.c>
  AddType image/svg+xml svg svgz
  AddEncoding gzip svgz
</IfModule>
<IfModule mod_dir.c>
  DirectoryIndex index.php index.html
</IfModule>
AddDefaultCharset utf-8
Options -Indexes
<IfModule pagespeed_module>
  ModPagespeed Off
</IfModule>

In the php.ini file I did basically also set: upload_max_filesize 16G and post_max_size 16G

When i login to my nextcloud and go under “admin”, it says max file size is set to 16G but I cant edit it from there.

Can someone help me?
I tried pretty much everything but still cant get it work.

I have also configured my system for 16G, but anything larger than 512M throws an error.

Does /var/www/nextcloud/.user.ini has an influence?

It should.
My .user.ini is as follows:
max_input_time=3600
max_execution_time=3600
memory_limit=512M
mbstring.func_overload=0
always_populate_raw_post_data=-1
default_charset='UTF-8’
output_buffering=0
upload_max_filesize=16G
post_max_size=16G

Same problem here:

Sabre\DAV\Exception\BadRequest: HTTP/1.1 400 expected filesize 780914688 got 450576384

OS: FreeBSD 10.3
Nextcloud Version: 11.0.1
PHP Version: 5.6.29

Has anyone figured out what the problem here is? I’m having the same exact issue.

i have the problem too, with my qnap-nas(TVS-EC1680U).
PHP7, Apache, Postgres, NextCloud 11.2

Does .htaccess AND .user.ini set the limitations, if both files are read by webserver? Or is there some priority which one supersedes the other?

Of course php-fpm does not read .htaccess, but with apache mod-php?

hi,

I have the same problem.
Trying to upload and 5G files.
Anyone can help plz ?

thx.

OS: Debian 8
Nextcloud Version: 11.0.1
PHP Version: 5.6

No one can help ?

Hello ;

Before nextcloud i had owncloud ( 9.0.6 ) on my centos 6 ( with php 5.5.38 ) and i could upload Bigger files.
More then 5G .

Now that doesnt work on nextcloud with my debian server.

I really need to upload big file if nextcloud cant just tell me plz.

Thx.

ok i found where the problem come from.

It’s from the /tmp.

I think that if u got a small /tmp like i had u cant upload big file…
My /tmp = 462M so i can upload only file less or egal 500M.

I input upload_tmp_dir = /var/www/nextcloud/data/upload-tmp in php.ini to use it
modify :
upload_max_filesize = xxxG
post_max_size = xxxG
output_buffering = 0
max_input_time 7200
max_execution_time 7200
memory_limit = 1024M

comment in .htaccess :
php_value upload_max_filesize xxxx
php_value post_max_size xxxx
php_value memory_limit xxxx

Now i can upload BIG FILE depend on upload_max_filesize and post_max_size.
I upload 9G with upload_max_filesize and post_max_size = 10G.
Everything with working good now.

Solution from : https://www.techandme.se/increase-max-file-size/

2 Likes