[Solved] Upload file forbidden

Nextcloud version (eg, 12.0.2): 12.0.5
Operating system and version (eg, Ubuntu 17.04): CentOS 7.4 kvm
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.29 (cPanel) OpenSSL/1.0.2n mod_bwlimited/1.4
PHP version (eg, 7.1): 7.0.27

The issue you are facing:
Hi, I’m new to NextCloud.
I have a fresh install NextCloud by using the web installer into a Cpanel server.
From the install wizard, NC said the required mod and PHP modules are installed in the server and installed smoothly.
But after NC is installed, I cannot upload (by Drag and Drop or File upload button) any files into my account.
I tried to check if its because PHP 7 disabled PUT and/or DELETE method, but those methods works right.

There are no error logs generated even I turned on debug mode in NC.

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

Steps to replicate it:

  1. Drag and Drop a file to the browser under “Files” tab
  2. Shows Forbidden message

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

$CONFIG = array (
  'instanceid' => '<instanceid>',
  'passwordsalt' => '<passwordsalt>',
  'secret' => '<secret>',
  'trusted_domains' => 
  array (
    0 => '<domain>',
  'datadirectory' => '<datadirectory>',
  'overwrite.cli.url' => '<overwrite.cli.url>',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => '<dbname>',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '<dbuser>',
  'dbpassword' => '<dbpassword>',
  'installed' => true,
  'debug' => true,
  'maintenance' => false,
  'theme' => '',


Anyone know the solution?
I tried to install NC to another cPanel server and it has the same issue.



While there’s no reply, I tried to install NC 11.0.7 into the same servers, file uploads still doesn’t work EXCEPT files without extension.
Is there any settings to allow or disallow any file types to upload into NC?


yes. 2 apps. one is called “file access control” the other one “ransomeware protection” - you might wanna check them out?
as well as the owner of your nextcloud-directory and the rights-setting?

good luck

Thanks JimmyKater, I just tried the 2 apps with all permission to all file types, but no luck.
And I have double checked the file permissions of the nextcloud-directory, even tho they are in the right permissions, I still can’t upload any files except those without extension.



could be a problem of centOS and/or your hoster, as well… but i really dont know. just came up with those common ideas from above - sorry :frowning:

Thank you so much anyways, I still trying to figure out what is the reason causing this issue.
Tried to change PHP version, but no luck.

Finally I found the reason. cPanel has enabled ModSecurity which blocks the file upload.