Server: Cannot upload 11.1 MB jpeg with nextcloud client

Created on 22 Jan 2018  路  3Comments  路  Source: nextcloud/server

Nextcloud version _(eg, 12.0.2)_: 12.0.4
Operating system and version _(eg, Ubuntu 17.04)_: FreeBSD 11.1 and Windows 10 client with nextcloud 2.3.2 (build 1)
Apache or nginx version _(eg, Apache 2.4.25)_: nginx 1.12.2
PHP version _(eg, 7.1)_: 7.1

The issue you are facing: Uploading a bigger jpeg (tested with 11.1MB big jpeg) fails using the nextcloud client, but works fine using the webinterface.

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

Steps to replicate it:

  1. Install Nextcloud client on windows and connect it to your nextcloud installation
  2. Place more than 11MB big jpeg into the a folder the nextcloud client syncs with the server (3.98MB file is working)
  3. As next step (to trigger the upload again) I just rename the file or simply copy and past the file in windows to have a new file to get synced

The output of your Nextcloud log in Admin > Logging:

There is nothing logged

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

<?php
$CONFIG = array (
  'instanceid' => '__REMOVED__',
  'passwordsalt' => '__REMOVED__',
  'secret' => '__REMOVED__',
  'trusted_domains' =>
  array (
    0 => '__REMOVED__',
    1 => '__REMOVED__',
    2 => '__REMOVED__',
  ),
  'datadirectory' => '/usr/local/clouddata',
  'dbtype' => 'mysql',
  'version' => '12.0.4.3',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => '__REMOVED__',
  'dbpassword' => '__REMOVED__',
  'installed' => true,
  'user_backends' =>
  array (
    0 =>
    array (
      'class' => 'OC_User_IMAP',
      'arguments' =>
      array (
        0 => '{vmail.__REMOVED__:143/imap/tls/novalidate-cert}',
      ),
    ),
  ),
  'theme' => '',
  'maintenance' => false,
  'loglevel' => 2,
  'trashbin_retention_obligation' => 'auto',
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\OC\Memcache\APCu',
);

Uploading a file using the nextcloud client:

2a01:5c0:__REMOVED__ - __USER_REMOVED__ [12/Jan/2018:11:09:42 +0100] "GET /ocs/v1.php/cloud/activity?page=0&pagesize=100&format=json HTTP/1.1" 200 1202 "-" "Mozilla/5.0 (Windows) mirall/2.3.2 (build 1) (Nextcloud)"
2a01:5c0:__REMOVED__ - __USER_REMOVED__ [12/Jan/2018:11:09:42 +0100] "PROPFIND /remote.php/dav/files/__USER_REMOVED__/ HTTP/1.1" 207 3175 "-" "Mozilla/5.0 (Windows) mirall/2.3.2 (build 1) (Nextcloud)"
2a01:5c0:__REMOVED__ - __USER_REMOVED__ [12/Jan/2018:11:09:42 +0100] "PROPFIND /remote.php/dav/files/__USER_REMOVED__/ HTTP/1.1" 207 526 "-" "Mozilla/5.0 (Windows) mirall/2.3.2 (build 1) (Nextcloud)"
2a01:5c0:__REMOVED__ - __USER_REMOVED__ [12/Jan/2018:11:09:43 +0100] "MKCOL /remote.php/dav/uploads/__USER_REMOVED__/3105625421 HTTP/1.1" 201 0 "-" "Mozilla/5.0 (Windows) mirall/2.3.2 (build 1) (Nextcloud)"
2a01:5c0:__REMOVED__ - __USER_REMOVED__ [12/Jan/2018:11:09:51 +0100] "PUT /remote.php/dav/uploads/__USER_REMOVED__/3105625421/00000000 HTTP/1.1" 201 0 "-" "Mozilla/5.0 (Windows) mirall/2.3.2 (build 1) (Nextcloud)"
2a01:5c0:__REMOVED__ - __USER_REMOVED__ [12/Jan/2018:11:09:52 +0100] "PUT /remote.php/dav/uploads/__USER_REMOVED__/3105625421/00000001 HTTP/1.1" 201 0 "-" "Mozilla/5.0 (Windows) mirall/2.3.2 (build 1) (Nextcloud)"
2a01:5c0:__REMOVED__ - __USER_REMOVED__ [12/Jan/2018:11:09:52 +0100] "MOVE /remote.php/dav/uploads/__USER_REMOVED__/3105625421/.file HTTP/1.1" 403 4390 "-" "Mozilla/5.0 (Windows) mirall/2.3.2 (build 1) (Nextcloud)"

Uploading the file using the webinterface:

2a01:5c0:__REMOVED__ - - [12/Jan/2018:11:14:34 +0100] "PUT /remote.php/webdav/photos/IMG_0029_4%20-%20Kopie%20-%20Kopie.JPG HTTP/2.0" 201 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
2a01:5c0:__REMOVED__ - - [12/Jan/2018:11:14:34 +0100] "PROPFIND /remote.php/webdav/photos/IMG_0029_4%20-%20Kopie%20-%20Kopie.JPG HTTP/2.0" 207 913 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
2a01:5c0:__REMOVED__ - - [12/Jan/2018:11:14:35 +0100] "GET /index.php/apps/files/ajax/getstoragestats.php?dir=%2Fphotos HTTP/2.0" 200 195 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
2a01:5c0:__REMOVED__ - - [12/Jan/2018:11:14:36 +0100] "GET /core/preview.png?file=%2Fphotos%2FIMG_0029_4+-+Kopie+-+Kopie.JPG&c=e472b260a6a6016e90a68ddb6e9466db&x=32&y=32&forceIcon=0 HTTP/2.0" 200 1259 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"

The folder permission for the user seems to be fine:

USER_REMOVED@HOST_REMOVED:/usr/local/clouddata/USER_REMOVED/uploads # ls -las
total 10
1 drwxr-xr-x   4 www  wheel   4 Jan 12 11:14 .
9 drwxr-xr-x  13 www  wheel  13 Jan 12 10:22 ..
1 drwxr-xr-x   2 www  wheel   5 Jan 12 11:07 4155650025
1 drwxr-xr-x   2 www  wheel   4 Jan 12 11:08 80493636

I asked that question in forum here:
https://help.nextcloud.com/t/cannot-upload-11-1-mb-jpeg-with-nextcloud-client/25768/2

But as I do not get an answer, I expect it is a bug, so I try to report it here.

Most helpful comment

I was now able to find the reason for this and maybe this information is also helpful for other users seeing the same problem.
The reason for this problem was a configuration block in nginx that denied access to all files/folders starting with a .:

location ~ (^|/)\. {
    return 403;
}

I modified it now to be more specific:

location ~ ^/(?:\.ht|\.git|\.svn|\.cvs){
    deny all;
}

The logline does now clearly show the problem to me:

"MOVE /remote.php/dav/uploads/__USER_REMOVED__/3105625421/.file HTTP/1.1" 403

The old rule has block the .file.

All 3 comments

@rullzer

I was now able to find the reason for this and maybe this information is also helpful for other users seeing the same problem.
The reason for this problem was a configuration block in nginx that denied access to all files/folders starting with a .:

location ~ (^|/)\. {
    return 403;
}

I modified it now to be more specific:

location ~ ^/(?:\.ht|\.git|\.svn|\.cvs){
    deny all;
}

The logline does now clearly show the problem to me:

"MOVE /remote.php/dav/uploads/__USER_REMOVED__/3105625421/.file HTTP/1.1" 403

The old rule has block the .file.

I recently came across this as well, my config was slightly different. Moved from:

location ~* /\.(?!well-known\/) { deny all; }

To:

location ~* /\.(?:!well-known|file\/) { deny all; }
This enabled file uploads which had the same MOVE 403 issue.

Was this page helpful?
0 / 5 - 0 ratings