Not able to upload files bigger than 8192 Bytes

Nextcloud version : 17.0.1
Operating system : Debian 10 (NextcloudPi)
Apache Version: 2.4.38
PHP version : 7.3.11

The issue you are facing:
After the configuration of my Nextcloud Server I started the initial synchronisation with my PC as the first client device. It successfully uploaded 820 MB, but since then my client always crashes in the uploading phase. In the nextcloud logs, something like the following gets logged:

Expected filesize of 57634 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 8192 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.

I checked it by uploading files manually over the web interface and indeed, all files with more than 8192 Bytes are denied, while those below are successfully uploaded.
In similar posts like Sabre\DAV\Exception\BadRequest: expected filesize 10485760 got 2554891 this problem normally happens with really big files in combination with the apache module mod_reqtimeout. I disabled with the entry

<IfModule reqtimeout_module>
  RequestReadTimeout header=0
  RequestReadTimeout body=0

in /etc/apache2/apache2.conf . However, this doesn’t solve the problem. Does anyone have an idea?

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Upload a file bigger than 8 kb via web interface or Nextcloud client

The output of your Nextcloud log in Admin > Logging:

Nextcloud Log
[webdav] Fatal: Sabre\DAV\Exception\BadRequest: Expected filesize of 57634 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 8192 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side. at <<closure>>

0. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 156
1. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1096
   OCA\DAV\Connector\Sabre\Directory->createFile("1612511462-hors ... g", null)
2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
   Sabre\DAV\Server->createFile("1612511462-hors ... g", null, null)
3. <<closure>>
   Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
4. /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
   undefinedundefinedcall_user_func_array([Sabre\DAV\CorePlugin {},"httpPut"], [Sabre\HTTP\Requ ... }])
5. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
   Sabre\Event\EventEmitter->emit("method:PUT", [Sabre\HTTP\Requ ... }])
6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
   Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
7. /var/www/nextcloud/apps/dav/appinfo/v1/webdav.php line 80
8. /var/www/nextcloud/remote.php line 163
   undefinedundefinedrequire_once("/var/www/nextcl ... p")

PUT /remote.php/webdav/test.jpg
from by ncp at 2019-12-19T20:46:57+00:00

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'passwordsalt' => '*hidden*',
  'secret' => '*hidden*',
  'trusted_domains' => 
  array (
  'datadirectory' => '/media/nextcloud-data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '*hidden*',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '*hidden*',
  'dbpassword' => '*hidden*',
  'installed' => true,
  'instanceid' => '*hidden*',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => '*hidden*',
  'tempdirectory' => '/media/nextcloud-data/tmp',
  'mail_smtpmode' => 'sendmail',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'admin',
  'mail_domain' => '',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'overwriteprotocol' => 'https',
  'maintenance' => false,
  'logfile' => '/media/nextcloud-data/nextcloud.log',
  'loglevel' => 2,

The output of your Apache/nginx/system log in /var/log/____:
There are different log files, and I don’t know which one is useful here. Please tell me if one of them is useful for you.

Thanks for your help!

1 Like

Edit: Earlier i wrote here, that a version update solved the problem. That was wrong. I did what was written in this post:

Also I commented out sys_temp_dir in /etc/php/7.3/fpm/php.ini, but I am not sure if that was necessary.

1 Like

Also see "HEADERS on invalid stream"
needs to be commented out or point to /path/to/nextcloud/tmp

But likely Nacho fixed this in NCPv1.20.1 / NC17.0.2 :wink:


hi scratchin_benni,
I have the EXACT error as yours.
in my apache2.conf
does not even contain:

<IfModule reqtimeout_module>
  RequestReadTimeout header=0
  RequestReadTimeout body=0

and keep having the issue.
going to see your link reference…

I confirm that, following the link you point out, I solved my uploading issues as well.
I also resolved the blank app store issue.
Now I see all the apps again.
It seems I resolved all issues at once.
Thanks for your post .

Hi kattivius,
I am happy that all my time and efford I spent for solving this problem also helped you :slight_smile:

1 Like

I had the same problem (using latest NextCloudPi version). Tried the above steps, creating folder and changing permissions, but couldn’t make it work. Then I found the “fix permissions” function on the webpanel of NextCloudPi
Now everything works as intended.
Unfortunately I cannot tell whether using this function first would have fixed the problem on its own.

Version info:
NextCloudPi version: v1.35.0
NextCloudPi image: NextCloudPi_11-27-20
Nextcloud version:

1 Like

After upgrading to the latest Nextcloud version supported by NCP (20.0.11), this message also appeared in my logs. Apparently the sys_temp_dir in php.ini was (once again) pointing to the wrong tmp-directory. It was fixed by manually creating a tmp-dir on my external HDD and updating the sys_temp_dir-path accordingly. Just wanted to let you know that this error still occurs.

1 Like


Hi, I have the same issues like you. Can you give a step by step instruction for dummies? I’m very desperate…

Not sure if this is any necessary but in the php.ini file there is also a section: File Uploads that has the default tmp default location. I changed that too to same defined tmp folder.
I run into this issue again after upgrading my nextcloudpi to version
I must say I did not expect running in to the same issue again. I suspect that I had that problem on a earlier update but I could not spend time to find reasons and solutions.
after making the changes and adding the tmp folder, I still had the same issue.
What happened:
after making the modifications, I had a windows when opening the webpage for NC saying I had to UPGRADE due to an app that had to be update.
After using the occ command for upgrade, the system rebooted automatically.
Tested a file transfer and had same issue.
I checked again the files with temp foders and they were correct.
So I used the suggestion from bob_grey : https://LAN_IP8:4443/?app=nc-fix-permissions ==> no joy
After SSH to nextcloud and manually reboot, it seems the issue is now gone. I can transfer files with no errors.
I am not sure what really helped or if is a combination of the actions that have solved the issue.