Raspi 4 4GB nextcloud upload failing

Nextcloud version: 20.0.2
Operating system and version: Raspbian GNU/Linux 10 (buster)
Apache or nginx version : Apache/2.4.38 (Raspbian)
PHP version (eg, 7.1): 7.3.19

The issue you are facing:
i keep getting " Error while copying file to target location (copied bytes: -1, expected filesize: -1 ) " when uploading via web broser. i read that it was often caused by slow storage, but that is not the case as you can see in these screenshots: https://1drv.ms/u/s!AvA2DBq3tqxzg882UmWdhwS-FZSgjw?e=yy8oxI

my nextcloud root is /var/www/html/nextcloud and my data location is /mnt/hdd/nextcloud

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

Steps to replicate it:

  1. start server.
  2. login.
  3. upload a file via web browser (chrome)

The output of your Nextcloud log in Admin > Logging:

my log file is way to large for pastebin. so here is it via onedrive: 


The output of your config.php file in /path/to/nextcloud:

$CONFIG = array (
  'instanceid' => 'oc8wz7druaze',
  'passwordsalt' => 'SVGrAJ0fMAmKYnWCyQK9Lc1KLf/eeP',
  'secret' => 'W4SpIyURtCtXpkkOkKlx1pI2cExTdAT/0sWLzPjeGq6ysjpp',
  'trusted_domains' =>
  array (
    0 => '',
    1 => 'MYIPADDRES',
  'datadirectory' => '/mnt/hdd/nextcloud/',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'http://MYIPADDRES/nextcloud',
  'htaccess.RewriteBase' => '/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'My uname',
  'dbpassword' => 'My password',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,

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

This log doesn't exist, only /var/log/apache2/ and in there "acces" "error" and "other vhost acces" logs

Hmm, errors I see in the log.

Host was not connected to because it violates local access rules.
You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at /var/www/html/nextcloud/3rdparty/patchwork/utf8/src/Patchwork/Utf8/Bootup/intl.php#18","userAgent":"Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36","version":""}

Solution for missing PHP Extension here on the forum and here are instructions on Github. Hope it helps.

I highly recommend migrating your system over to NextcloudPi. Basically gives sane default setup for your device if you are into it. https://t.me/nextcloudpi

will def look at tha. i cant use the nextcloudpi img becasue theres way more installed on my py than just nextcloud. id rather redo nextcloud than everything else. also do u think this missing php is causing the failed uploads?

eddit: the module was already installed but prolly not activated. did that now and im testing the upload (or if that error returns)

It didn’t work. I fixed the fallback error and also fixed the oc memory error. But I’m still getting the cannot modify header information and the “Sabre\DAV\Exception: Error while copying file to target location (copied bytes: -1, expected filesize: -1 )”

ive upped the memory limit to 3072M and now i am able to upload larger files. but the movie file that im trying to upload is 4gb. i think it has to do with memory limit. so, would there be a way to make it use zram or a temp folder instead of ram (also when i did upload a 2GB file it didnt actually use 2 gb of ram, only 750MiB at max)

i think its caused by php being 32bit. i dont know how to turn it into 64 bit and i also think its not even supported yet by raspbian. so im closing this

Sounds like you are stuck on the 32-bit version of Raspbian. Unfortunately, it is distributed by default by the Raspberry Pi Foundation. Below is process to confirm, plus links to 64-bit Raspbian.

I am on pi 4 and will do all in my ability to switch to 64 bit. Since it printed armhf

64 bit worked flawlessly