Can't upload to SMB folders using webdav

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version : 15.0.2
Operating system and version: Ubuntu 18.10
Apache version: 2.4.34
PHP version: 7.1.26

Can’t upload files through webdav when destination is a external SMB-folder.
Even a tiny <10kb file wont work, and a simple filename such as “xxx”.
downloading and browsiing works fine through webdav

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

Steps to replicate it:

  1. Setup SMB/CIFS-target in User-Settings using global credentials,
  2. Verify that a fileupload to the SMB-folder works in the webgui.
  3. Map https:///remote.php/webdav in windows 10/android and upload a file called “xxx” to folder

The output of your Nextcloud log in Admin > Logging:

[webdav] Fatal: Sabre\DAV\Exception: Error while copying file to target location (copied bytes: 0, expected filesize: 0 ) at <<closure>>

0. /var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 156
   put(null)
1. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1096
   createFile("xxx", null)
2. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
   createFile("ISO/RPi/xxx", null, null)
3. <<closure>>
   httpPut(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
4. /var/www/html/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
   call_user_func_array([Sabre\DAV\CorePlugin {},"httpPut"], [Sabre\HTTP\Requ ... }])
5. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
   emit("method:PUT", [Sabre\HTTP\Requ ... }])
6. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
   invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
7. /var/www/html/nextcloud/apps/dav/appinfo/v1/webdav.php line 80
   exec()
8. /var/www/html/nextcloud/remote.php line 163
   require_once("/var/www/html/n ... p")

PUT /remote.php/webdav/ISO/RPi/xxx
from <external ip> by <user> at 2019-01-15T15:58:34+00:00

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

<?php
$CONFIG = array (
  'instanceid' => <instanceid>,
  'passwordsalt' => <hash>,
  'secret' => <secret>,
  'trusted_domains' =>
  array (
    0 => '192.168.1.<nn>',
    1 => '<domain>.org',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '15.0.2.0',
  'overwrite.cli.url' => 'http://192.168.1.<nn>/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nc',
  'dbpassword' => <secret>,
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => <domain>,
  'mail_from_address' => 'nextcloud',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpport' => '465',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpname' => 'nextcloud@<domain>',
  'mail_smtppassword' => <secret>,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => false,
  'updater.release.channel' => 'stable',
  'theme' => '',
  'loglevel' => 2,
);

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

192.168.1.<nn> - <user> [15/Jan/2019:21:21:43 +0000] "PROPFIND /remote.php/webdav/ISO/xxx HTTP/1.1" 404 974 "-" "Microsoft-WebDAV-MiniRedir/10.0.17763"
192.168.1.<nn> - <user> [15/Jan/2019:21:21:43 +0000] "PUT /remote.php/webdav/ISO/xxx HTTP/1.1" 500 923 "-" "Microsoft-WebDAV-MiniRedir/10.0.17763"
192.168.1.<nn> - <user> [15/Jan/2019:21:21:44 +0000] "PROPFIND /remote.php/webdav/ISO/xxx HTTP/1.1" 404 1099 "-" "Microsoft-WebDAV-MiniRedir/10.0.17763"
192.168.1.1 - - [15/Jan/2019:21:21:33 +0000] "GET /index.php/apps/logreader/poll?lastReqId=4frwsUfadUtttWpQggef HTTP/1.1" 200 7002 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.<nn> - <user> [15/Jan/2019:21:21:44 +0000] "PUT /remote.php/webdav/ISO/xxx HTTP/1.1" 500 923 "-" "Microsoft-WebDAV-MiniRedir/10.0.17763"
192.168.1.<nn> - <user> [15/Jan/2019:21:21:47 +0000] "PROPFIND /remote.php/webdav/ISO/xxx HTTP/1.1" 404 1099 "-" "Microsoft-WebDAV-MiniRedir/10.0.17763"
192.168.1.1 - - [15/Jan/2019:21:21:45 +0000] "GET /index.php/apps/logreader/poll?lastReqId=<randomid> HTTP/1.1" 200 7002 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.<nn> - <user> [15/Jan/2019:21:21:48 +0000] "PROPFIND /remote.php/dav/files/<user>/ HTTP/1.1" 207 1359 "-" "Mozilla/5.0 (Windows) mirall/2.5.1final (build 20181204) (Nextcloud)"
192.168.1.1 - - [15/Jan/2019:21:21:48 +0000] "GET /index.php/apps/logreader/poll?lastReqId=kxtFeOn0nUBHStSfVCyw HTTP/1.1" 200 7002 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.<nn> - <user> [15/Jan/2019:21:21:47 +0000] "PUT /remote.php/webdav/ISO/xxx HTTP/1.1" 500 923 "-" "Microsoft-WebDAV-MiniRedir/10.0.17763"

I used sftp connector to the same destination and it behaves the same can browse and download but not upload