NextClould Upload Folder Only Allowing Certain File Types

Nextcloud version (eg, 20.0.5): 24.0.2
Operating system and version (eg, Ubuntu 20.04): Not sure. I’m running this on a Bluehost share and don’t know how to determine that.
Apache or nginx version (eg, Apache 2.4.25): Same as previous answer.
PHP version (eg, 7.4): 7.3.33

The issue you are facing:

I have a basic NextCloud set up with a public shared upload folder, which I’ve set up to allow people to upload their photos and videos of an event. Photo upload works fine, but when trying to upload a video file, the error “Could not upload [filename]” appears. Interestingly, it doesn’t seem to be a file size problem, since if I try to upload a very small video file or a file with, say, a .css or .sh extension, I get the same error. .txt files work. If I take a file that won’t upload and change it to a file type that will upload (ex. mp4 → jpg), the file appears to upload fine, but then I get the “Could not upload” error at the end of the upload process, and the file does not appear in the uploads folder.

I tried installing the File Access Control app, but that only allows me to block certain file types, not allow types that are otherwise blocked, so I disabled it.

I also checked with Bluehost, and none of their restricted file types include the ones that are giving me trouble, so I don’t think it’s an issue with the hosting server.

There is nothing in the logger that points to a problem, even when I have the logging level set to 0.

I’m brand new to NextCloud, so I’d appreciate any advice the community can provide. Thanks!

Is this the first time you’ve seen this error? (Y/N): Yes, but I’m new to NextCloud, so this is the first time I’ve seen everything.

Steps to replicate it:

  1. Install NextCloud on a Bluehost share using the Web Installer and keeping the defaults.
  2. Set up a public shared upload folder for anonymous uploads, as described here: Making anonymous uploads — Nextcloud latest User Manual latest documentation
  3. Try to drag and drop various file types. Image and text files should work. Other file types should not.

The output of your Nextcloud log in Admin > Logging:

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

<?php
$CONFIG = array (
  'instanceid' => {instanceid},
  'passwordsalt' => {passwordsalt},
  'secret' => {secret},
  'trusted_domains' => 
  array (
    0 => 'mydomain.com',
  ),
  'datadirectory' => '/home4/{username}/public_html/nextcloud/data',
  'dbtype' => 'sqlite3',
  'version' => '24.0.2.1',
  'overwrite.cli.url' => 'https://mydomain.com/nextcloud',
  'installed' => true,
  "loglevel" => 0,
  'mail_from_address' => {mail_from_address},
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'gmail.com',
  'mail_smtpsecure' => 'ssl',
  'mail_smtphost' => 'smtp.gmail.com',
);

The output of your Apache/nginx/system log in /var/log/____:
Since I’m on a Bluehost share, I don’t have this.

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

Nothing appears in the logger in response to a failed upload. Here are the errors that have appeared in the log since I first set up NextCloud:

Error	no app in context	Exception: OC\Files\Storage\Local::calculateEtag(): Argument #2 ($stat) must be of type array, bool given, called in /home4/{username}/public_html/nextcloud/lib/private/Files/Storage/Local.php on line 505 in file '/home4/{username}/public_html/nextcloud/lib/private/Files/Storage/Local.php' line 508
Error	index	OCP\Files\NotPermittedException: Could not create folder
Error	index	OCP\Files\NotPermittedException: Could not create folder
Error	index	OCP\Files\NotPermittedException: Could not create folder

Are you using the Files Access Control app?
If so, it would be the problem.

If that is not the issue you can contact Bluehost support directly for assistance since they are your hosting provider. I’ve always found them extremely helpful.

As indicated in my original post, I tried the Files Access Control app, and it didn’t work, so I disabled it. As I also indicated in my original post, I’ve already spoken to Bluehost. They concluded it was a NextCloud problem since none of the blocked files match their list of restricted file types.

Hmm, Nextcloud includes no file type limitations by default afaik.

Check your share permissions of that folder.
Check your user permissions against the folder you are attempting to upload to.

It is possible previous use of file access app is still causing issues. Anything else as far as errors from your logs under top right admin panel?

Share permissions on the upload folder are rwxr-xr-x. It has my username for both the owner and group. I don’t see how folder permissions could limit the type of file uploaded, though. The problem existed before I even installed the File Access app, and I installed it to try to correct the problem but disabled it when it became apparent it wouldn’t help.

I found a post with a similar issue here: Unable to upload certain file types... Ideas?. The poster’s solution was just to wipe and reinstall NextCloud, which I’m hoping to avoid if possible.

One thought: I am using sqlite. Could that be causing issues?

I tried installing a second instance of NextCloud in a separate directory. This time, I used a MySQL database. The same issue occurred. I also tried changing the permissions of the upload folder, again to no effect, although the error would change to “An unknown error occurred”. Still nothing in the logs.

After further digging, it seems like the server is generating a 406 error when I try to upload one of these files. This suggests that it might be a Bluehost issue after all. This post here (which explicitly mentions Bluehost) seems to support this idea: Desktop Client Error : Server replied "406 Not Acceptable" to PUT - #4 by rakekniven

1 Like

I talked to Bluehost again, and they can’t find anything wrong on their end. There’s nothing in their server error logs. So I don’t know where the problem lies at this point.