Inability to upload file to external FTP storage

Nextcloud version: 27.1.3.2
Operating system and version : Debian GNU/Linux 11. 6.2.16-18-pve (x86_64)
Apache or nginx version: 2.4
PHP version : 8.1.25

Installation: NextcloudPi_lxc_11-19-23
NextcloudPi version: v1.53.0

The issue you are facing:
Via the “external storage” extension, I connected FTP to nextcloud (1st physical server) to a folder in my NAS server (2nd physical server).
Connection is via ftp://, login via user and password. Nextcloud in the administration shows that the FTP is connected correctly (green icon).
However, when I try to upload a photo to this folder via nextclou WebUI, I get the following error described below. When I upload this photo to another folder in nextcloud, the transfer works perfectly normally. But not on external storage.
Here is the description of the error:

Is this the first time you’ve seen this error?: Y

The output of your Nextcloud log in Admin > Logging:

`[no app in context] Error: Sabre\DAV\Exception\BadRequest: Expected filesize of 182996 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 0 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 149
   OCA\DAV\Connector\Sabre\File->put()
1. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1098
   OCA\DAV\Connector\Sabre\Directory->createFile("*** sensitive parameters replaced ***")
2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 504
   Sabre\DAV\Server->createFile("*** sensitive parameters replaced ***")
3. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
   Sabre\DAV\CorePlugin->httpPut()
4. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
   Sabre\DAV\Server->emit()
5. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
   Sabre\DAV\Server->invokeMethod()
6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
   Sabre\DAV\Server->start()
7. /var/www/nextcloud/apps/dav/appinfo/v1/webdav.php line 85
   Sabre\DAV\Server->exec()
8. /var/www/nextcloud/remote.php line 172
   require_once("/var/www/nextcl ... p")
`

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

`<?php
$CONFIG = array (
  'passwordsalt' => 'C/Zk0F/"*** sensitive parameters replaced ***"',
  'secret' => '"*** sensitive parameters replaced ***"/',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    7 => 'nextcloudpi',
    5 => 'nextcloudpi.local',
    8 => 'nextcloudpi.lan',
    3 => 'nextcloudpi',
    11 => '109.164.83.240',
    1 => '192.168.1.70',
    14 => 'nextcloudpi.local',
    20 => 'nextcloud."*** sensitive parameters replaced ***".cz',
  ),
  'datadirectory' => '/opt/ncdata/data',
  'dbtype' => 'mysql',
  'version' => '27.1.3.2',
  'overwrite.cli.url' => 'https://nextcloudpi/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'ncadmin',
  'dbpassword' => '"*** sensitive parameters replaced ***"',
  'installed' => true,
  'instanceid' => 'ocnlhaxuz7gk',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => '"*** sensitive parameters replaced ***"',
  ),
  'tempdirectory' => '/opt/ncdata/data/tmp',
  'mail_smtpmode' => 'sendmail',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'admin',
  'mail_domain' => 'ownyourbits.com',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'overwriteprotocol' => 'https',
  'maintenance' => false,
  'logfile' => '/opt/ncdata/data/nextcloud.log',
  'trusted_proxies' =>
  array (
    11 => '127.0.0.1',
    12 => '::1',
    13 => 'nextcloudpi',
    14 => '',
    0 => 'nextcloud."*** sensitive parameters replaced ***".cz',
    1 => '192.168.1.0/24',
  ),
);
`