nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.69k stars 4k forks source link

Can't upload images in "Theming" app #18328

Open systems-levigo opened 4 years ago

systems-levigo commented 4 years ago

Steps to reproduce

  1. Upload an image file (svg or png) in the Theming app (Design area) Logo / Loginscreen / Headarea-Logo / Favicon

Expected behaviour

Images should change

Actual behaviour

A error appears "No file uploaded"

Server configuration

Operating system: Debian 10

Web server: Apache 2.4

Database: MariaDB

PHP version: 7.3

Nextcloud version: (see Nextcloud admin page) 16.0.5

Updated from an older Nextcloud/ownCloud or fresh install: Updated from older NC 10/11 a long time ago

Where did you install Nextcloud from: GUI -> NC

List of activated apps:

App list ``` Enabled: - accessibility: 1.2.0 - activity: 2.9.1 - admin_audit: 1.6.0 - bruteforcesettings: 1.4.0 - cloud_federation_api: 0.2.0 - comments: 1.6.0 - dav: 1.9.2 - federatedfilesharing: 1.6.0 - federation: 1.6.0 - files: 1.11.0 - files_external: 1.7.0 - files_pdfviewer: 1.5.0 - files_rightclick: 0.15.1 - files_sharing: 1.8.0 - files_texteditor: 2.8.0 - files_trashbin: 1.6.0 - files_versions: 1.9.0 - files_videoplayer: 1.5.0 - firstrunwizard: 2.5.0 - gallery: 18.3.0 - logreader: 2.1.0 - lookup_server_connector: 1.4.0 - notifications: 2.4.1 - oauth2: 1.4.2 - password_policy: 1.6.0 - privacy: 1.0.0 - provisioning_api: 1.6.0 - recommendations: 0.4.0 - serverinfo: 1.6.0 - sharebymail: 1.6.0 - support: 1.0.0 - systemtags: 1.6.0 - theming: 1.7.0 - twofactor_backupcodes: 1.5.0 - updatenotification: 1.6.0 - viewer: 1.1.0 - workflowengine: 1.6.0 Disabled: - encryption - external - nextcloud_announcements - survey_client - user_ldap ```

Nextcloud configuration:

Config report ``` { "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "cloud.example.de" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "version": "16.0.5.1", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "forcessl": true, "mail_smtpmode": "smtp", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "maintenance": false, "loglevel": 2, "asset-pipeline.enabled": true, "trashbin_retention_obligation": "auto", "updatechecker": true, "memcache.local": "\\OC\\Memcache\\APCu", "updater.release.channel": "stable", "overwrite.cli.url": "https:\/\/cloud.example.de", "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "25", "mail_smtpauthtype": "LOGIN", "mysql.utf8mb4": true } } ```

Are you using encryption: no

Client configuration

Browser: Firefox, Chromium

Operating system: Linux

Logs

Web server error log

Web server error log ``` xxx.xxx.xxx.xxx - - [10/Dec/2019:12:13:51 +0100] "POST /index.php/apps/theming/ajax/uploadImage HTTP/1.1" 422 1658 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36" ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` No logs while or after uploading. ```

Browser log

Browser log ``` POST https://cloud.example.de/index.php/apps/theming/ajax/uploadImage 422 (Unprocessable Entity) jquery.js:8630   | send | @ | jquery.js:8630 -- | -- | -- | --   | ajax | @ | jquery.js:8166   | send | @ | jquery.fileupload.js?v=d9c5ef32-5:909   | _onSend | @ | jquery.fileupload.js?v=d9c5ef32-5:971   | (anonymous) | @ | jquery-ui.js:144   | data.submit | @ | jquery.fileupload.js?v=d9c5ef32-5:677   | (anonymous) | @ | jquery.fileupload.js?v=d9c5ef32-5:218   | u | @ | jquery.js:3099   | add | @ | jquery.js:3145   | add | @ | jquery.fileupload.js?v=d9c5ef32-5:217   | _trigger | @ | jquery-ui.js:697   | (anonymous) | @ | jquery.fileupload.js?v=d9c5ef32-5:1040   | each | @ | jquery.js:374   | _onAdd | @ | jquery.fileupload.js?v=d9c5ef32-5:1033   | (anonymous) | @ | jquery-ui.js:144   | (anonymous) | @ | jquery.fileupload.js?v=d9c5ef32-5:1238   | u | @ | jquery.js:3099   | add | @ | jquery.js:3145   | always | @ | jquery.js:3246   | _onChange | @ | jquery.fileupload.js?v=d9c5ef32-5:1228   | (anonymous) | @ | jquery-ui.js:144   | a | @ | jquery-ui.js:606   | dispatch | @ | jquery.js:4435   | _.handle | @ | jquery.js:4121 ```
kesselb commented 4 years ago

Unprocessable Entity could be:

https://github.com/nextcloud/server/blob/5bf3d1bb384da56adbf205752be8f840aac3b0c5/apps/theming/lib/Controller/ThemingController.php#L249-L255

Something went wrong during upload. If so the response should contain some useful information.

https://github.com/nextcloud/server/blob/5bf3d1bb384da56adbf205752be8f840aac3b0c5/apps/theming/lib/Controller/ThemingController.php#L273-L279

Server does not support svg.

systems-levigo commented 4 years ago

I did a bit of debugging and found something: While uploading the PNG image (logo) this if is called:

               if (empty($image)) {
                        $error = $this->l10n->t('No file uploaded');
                }

Accordingly, from my point of view, it must be a bigger problem. Do you have any ideas?

kesselb commented 4 years ago

No. Are you able to reproduce this failure with https://hub.docker.com/_/nextcloud or https://try.nextcloud.com?

systems-levigo commented 4 years ago

Can't be reproduced on a NC 17.x. Updated from v 11/12.

ghost commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

systems-levigo commented 4 years ago

Any ideas how to fix this issue?

xxfuma85xx commented 4 years ago

Same here, Nextcloud fresh install version 18.0.1. I added some line in uploadImage function in ThemingController.php file to try to debug this issue. At line 253 I added to data response to return $image, $this-request->files and $_FILES variables but all of them are empty ($image = null). I tried uploading jpg and png files and the result is the same.

systems-levigo commented 4 years ago

A other NC instance fresh upgraded from 13 - 17: Uploading PNG images through the theming app works.

ghost commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

systems-levigo commented 4 years ago

The problem is not yet resolved.

systems-levigo commented 4 years ago

Updated nextcloud 16 to 18. Still Apache ERROR 422.

harrybeards commented 4 years ago

For anyone having this issue, try checking your nextcloud.log file after you try to upload something. I was having this same issue and I checked the logs, and found this:

"app":"PHP","method":"POST","url":"/apps/theming/ajax/uploadImage","message":"POST Content-Length of 194480 bytes exceeds the limit of 1024 bytes at Unknown#0","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36","version":"18.0.4.2"}

Basically, there was an issue with my php.ini file. My upload_max_filesize parameter wasn't set high enough and was rejecting any file that was larger than a few kilobytes. I set it to upload_max_filesize = 1000M, restarted my PHP service (sudo systemctl restart php7.3-fpm.service), and reloaded my webserver, and the issue went away.

Hope this helps anyone who's been trying to figure this issue out like I've been!

systems-levigo commented 4 years ago

In our case it is definitely a code problem..

Domynos commented 4 years ago

I'm having a similar issue.

Error message displaying : "The uploaded file exceeds the upload_max_filesize directive in php.ini"

My php.ini upload_max_filesize is set to 500M and i'm not having any problem uploading documents in finder.

Nextcloud 18.0.4

systems-levigo commented 3 years ago

The problem still persists in a clean NC 19.0.4 installation. "POST /apps/theming/ajax/uploadImage HTTP/1.1" 422

Any ideas? Normal uploads via webgui are working.

EDIT: Not even the loginscreen upload is working anymore..

tuxmaster5000 commented 2 years ago

Same on 22.2.3 :( Not error is logged.

solracsf commented 2 years ago

Can you attach the image that fails please?

tuxmaster5000 commented 2 years ago

I have tried with an svg file. Tux.zip

tonyzhou777 commented 2 years ago

I had the same issue. After I installed "PHP fileinfo extension", I am able to upload customized icon.

tuxmaster5000 commented 2 years ago

Hm, in my case the extension is installed by default, so the source of the problem must be another.

systems-levigo commented 2 years ago

Yeah, normally the php-fileinfo package should be included in the php-common package. Must be another problem.

ghost commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

tuxmaster5000 commented 2 years ago

Yesterday I tested it again with 22.2.5, but the problem is the same.

ghost commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

tuxmaster5000 commented 2 years ago

22.2.6 will shown the same behaviour. :(

nextcloud-command commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

systems-levigo commented 2 years ago

We can confirm that we got the same error on version 22.2.6.

nextcloud-command commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

tuxmaster5000 commented 2 years ago

Same on 23.5

flotpg commented 2 years ago

Same here on 24.0.2 CleanShot 2022-07-11 at 14 37 34@2x

flotpg commented 2 years ago

Still the same on: 24.0.3

nextcloud-command commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

florian-obradovic commented 2 years ago

Still the same on: 24.0.4 How can we fix this? Currently we're not able to brand our instance.

florian-obradovic commented 2 years ago

Found a solution!

In my php.ini upload_max_filesize was set to 32GB. I noticed that it doesn't reflect / show this value correctly under Administration > System > PHP Info Section: CleanShot 2022-08-24 at 09 33 44@2x When I set upload_max_filesize = 1024M in the /etc/php/8.0/apache2/php.ini it works: CleanShot 2022-08-24 at 09 35 05@2x

If I set it to upload_max_filesize = 32768M instead of 32GB it's still reported correctly and logo upload still works CleanShot 2022-08-24 at 09 35 50@2x

tuxmaster5000 commented 2 years ago

I my case there are 2MB shown, but the file is only some kb big.

florian-obradovic commented 2 years ago

I also set post_max_size = 0 Memory_Limit is 4096M

systems-levigo commented 2 years ago

Our upload_max_filesize is set to 3072M and and it shows up correctly in nextcloud. Upload of logo is not working with this setting.

XLixl4snSU commented 1 year ago

25.0.0 same issue. I wanted to change my logo and removed the existing one, now I can't upload anything in theming anymore. Normal upload works fine.

@florian-obradovic Thank you, your workaround fixes the error.

szaimen commented 1 year ago

Hi, please update to 24.0.8 or better 25.0.2 and report back if it fixes the issue. Thank you!

tuxmaster5000 commented 1 year ago

Same on 24.0.8. OS CentOS 7.9, PHP 8.0 (PFM), Apache

szaimen commented 1 year ago

What is your upload_max_filesize set to? Can you check in the serverinfo view?

tuxmaster5000 commented 1 year ago

upload_max_filesize is the PHP default of 2MB. But in PPM mode, this value looks like to be ignored, because I can update files with many GB's.

szaimen commented 1 year ago

upload_max_filesize is the PHP default of 2MB

So we found your problem! Please adjust it correctly and report back if it fixes your issue!

tuxmaster5000 commented 1 year ago

No, because the image are only some kb's big.

szaimen commented 1 year ago

How many KB? Also can you increase the limit at least to 50MB and check if that makes it work?

DalekDave commented 1 year ago

This issue still seems to exist on 25.0.3. I upgraded from Nextcloud 24 today. The upgrade went OK, but Nextcloud seemed to lose my custom logo and background in the process.

I uploaded a Logo (used on the login page, a Header Logo (used in the header), a Favicon, and a Background and Login Image.

All uploaded OK except the Logo. I decided to upload another Header Logo, and I could no longer succeed in uploading a file. These are small files of less than 100KB.

Every time I get the error message "Error uploading the file", plus another error message on the right saying that the server connection had been lost.

Please see the screenshot below (it shows both messages):

Screenshot_20230213_210833

I can upload files in the Files app perfectly normally. The site has been operating perfectly normally for months.

This error just occurred after the upgrade to Nextcloud 25.0.3.

So the error seems to be characterized by the fact that I managed a first upload OK of 3 images OK, and then it started mysteriously failing.

DalekDave commented 1 year ago

I have tried flushing the browser cache (up-to-date Firefox on Ubuntu KDE 22.04). That made no difference. The problem persists.

DalekDave commented 1 year ago

I also tried checking the 'post_max_size' setting in my PHP 8.1 php.ini. That did'nt help. No difference. My server's PHP is configured for big file sizes in all PHP parameters.

See the screenshot below from the Nextcloud Admin settings -> System -> PHP info section:

Screenshot_20230213_213629

So now I can't currently customize my instance.

Has anyone got a solution or workaround for this, please?

BeezBeez commented 1 year ago

Same problem here. And I seem like to have the same settings than you.

skjnldsv commented 1 year ago

Have anyone tried with different browsers too?