Error while copying file to target location (copied bytes: 0, expected filesize: -1 )

Nextcloud version 18.0.2:
Operating system and version Raspbian Buster:
Apache or nginx version Apache 2.4.41-2~20190819.8+debian10:
PHP version 7.3.14-1~deb10u1:
Raspberry 4, Linux 4.19.97-v8+ #1294 SMP PREEMPT Thu Jan 30 13:27:08 GMT 2020 aarch64 GNU/Linux

The issue you are facing:
I can’t upload big files in the order of some GBs.

Is this the first time you’ve seen this error? Y: Recently I switched to the most powerful raspberry, and this is the first time I need to work with files of ~10GB.

Steps to replicate it:

Just upload a file of some GB.

The output of your Nextcloud log in Admin > Logging:

{"reqId":"gouTIiaTomaHLv094Prr","level":4,"time":"2020-03-14T15:47:41+00:00","remoteAddr":"","user":"username","app":"webdav","method":"MOVE","url":"/remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","message":{"Exception":"Sabre\\DAV\\Exception","Message":"Error while copying file to target location (copied bytes: 0, expected filesize: -1 )","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":156,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->","args":[null]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":316,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["FILENAME",null]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":130,"function":"copyNode","class":"Sabre\\DAV\\Tree","type":"->","args":[{"__class__":"OCA\\DAV\\Upload\\FutureFile"},{"__class__":"OCA\\DAV\\Connector\\Sabre\\Directory"},"FILENAME"]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":161,"function":"copy","class":"Sabre\\DAV\\Tree","type":"->","args":["uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","files/username/temp/FILENAME"]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":642,"function":"move","class":"Sabre\\DAV\\Tree","type":"->","args":["uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","files/username/temp/FILENAME"]},{"function":"httpMove","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https://website/remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpMove"],[{"absoluteUrl":"https://website/remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:MOVE",[{"absoluteUrl":"https://website/remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https://website/remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/nextcloud/apps/dav/lib/Server.php","line":319,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/nextcloud/remote.php","line":165,"args":["/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":219,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36","version":"18.0.2.2","id":"5e6d0b5140f7a"}
{"reqId":"gouTIiaTomaHLv094Prr","level":3,"time":"2020-03-14T15:47:40+00:00","remoteAddr":"192.168.0.2","user":"username","app":"no app in context","method":"MOVE","url":"/remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","message":{"Exception":"Sabre\\DAV\\Exception","Message":"Error while copying file to target location (copied bytes: 0, expected filesize: -1 )","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":156,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->","args":[null]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":316,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["FILENAME",null]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":130,"function":"copyNode","class":"Sabre\\DAV\\Tree","type":"->","args":[{"__class__":"OCA\\DAV\\Upload\\FutureFile"},{"__class__":"OCA\\DAV\\Connector\\Sabre\\Directory"},"FILENAME"]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":161,"function":"copy","class":"Sabre\\DAV\\Tree","type":"->","args":["uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","files/username/temp/FILENAME"]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":642,"function":"move","class":"Sabre\\DAV\\Tree","type":"->","args":["uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","files/username/temp/FILENAME"]},{"function":"httpMove","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https://website/remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpMove"],[{"absoluteUrl":"https://website/remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:MOVE",[{"absoluteUrl":"https://website/remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https://website/remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/nextcloud/apps/dav/lib/Server.php","line":319,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/nextcloud/remote.php","line":165,"args":["/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":219,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36","version":"18.0.2.2","id":"5e6d0b51410f2"}


The output of your user.ini

mbstring.func_overload=0
always_populate_raw_post_data=-1
default_charset='UTF-8'
output_buffering=0
upload_max_filesize=25G
post_max_size=25G

From the php.ini

post_max_size = 25G
upload_max_filesize = 25GB

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

cat config/config.php 
<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' => 
  array (
    0 => '',
  ),
  'datadirectory' => '',
  'dbtype' => '',
  'version' => '',
  'overwrite.cli.url' => '',
  'dbname' => '',
  'dbhost' => '',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '',
  'dbpassword' => '',
  'installed' => true,
  'mail_smtpmode' => 'sendmail',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'pipe',
  'mail_from_address' => '',
  'mail_domain' => '',
  'mail_smtpauth' => 1,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtphost' => '',
  'mail_smtpport' => '465',
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'updater.secret' => '',
);

The output of your Apache/nginx/system log in /var/log/____:

192.168.1.2 - - [14/Mar/2020:14:00:02 +0100] "GET /index.php/csrftoken HTTP/1.1" 200 1519 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
192.168.1.2 - - [14/Mar/2020:14:00:02 +0100] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 5642 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
192.168.1.2 - - [14/Mar/2020:13:59:48 +0100] "GET /index.php/apps/logreader/poll?lastReqId=UATE7yeguN1uo4tVjuPS HTTP/1.1" 200 841 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
192.168.1.2 - - [14/Mar/2020:14:00:11 +0100] "GET /index.php/apps/logreader/poll?lastReqId=UATE7yeguN1uo4tVjuPS HTTP/1.1" 200 841 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
192.168.1.2 - - [14/Mar/2020:14:00:32 +0100] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 5642 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
192.168.1.2 - - [14/Mar/2020:14:00:31 +0100] "GET /index.php/apps/logreader/poll?lastReqId=UATE7yeguN1uo4tVjuPS HTTP/1.1" 200 841 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
192.168.1.2 - - [14/Mar/2020:14:01:02 +0100] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 5642 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"

CUT
192.168.1.2 - - [14/Mar/2020:16:45:39 +0100] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 5642 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
192.168.1.2 - - [14/Mar/2020:16:45:04 +0100] "PUT /remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/4676648960 HTTP/1.1" 201 718 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
192.168.1.2 - - [14/Mar/2020:16:46:09 +0100] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 5642 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
192.168.1.2 - - [14/Mar/2020:16:45:59 +0100] "PUT /remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/4687134720 HTTP/1.1" 201 718 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
192.168.1.2 - - [14/Mar/2020:16:46:11 +0100] "PUT /remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/4697620480 HTTP/1.1" 201 718 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
192.168.1.2 - - [14/Mar/2020:16:46:12 +0100] "MOVE /remote.php/dav/uploads/username/web-file-upload-a9aefb5d3c0d83ced28134a161d5a10c-1584191435846/.file HTTP/1.1" 500 939 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
192.168.1.2 - - [14/Mar/2020:16:47:14 +0100] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 8842 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"