WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#50188 new enhancement

Disable Media uploader if PHP file_uploads is disabled

Reported by: JavierCasares Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version:
Component: Upload Keywords: 2nd-opinion needs-patch
Focuses: Cc:

Description

Based on ticket #50038, if the PHP configuration is file_uploads = Off we should disable the Media upload.

Actually, when you upload a file and the file_uploads is disabled, WordPress uploads the file with a progress bar and, at the end, it gives an error because is disabled.

This should affect the Media upload, probably it should tell something like "You can't upload a file, please check the Site Health for more information" (or something like that) but also, in any file upload (like the Image / Video / Audio on Gutenberg) should allow to pick from the media but not show the upload button, also the plugin / theme upload.

Attachments (2)

upload-settings.png (25.3 KB) - added by ayeshrajans 3 months ago.
A preview of the file upload settings debug information
50188.patch (2.7 KB) - added by ayeshrajans 3 months ago.
A patch that adds a new "File upload settings" section to Site Health > Debug page. It takes values from PHP INI settings, and also shows the effective file size (min value of the post-max and max-file-size settings).

Download all attachments as: .zip

Change History (8)

#1 @SergeyBiryukov
3 months ago

  • Keywords needs-patch added

#2 @ayeshrajans
3 months ago

  • Keywords needs-patch removed

Hi @JavierCasares - welcome back to WP Trac.
I think it's a great idea to have a Health Check section for file uploads. Disabling the file upload button and the error message contents will need some discussing back and forth with core maintainers to deciding the UX patterns, but I will be working on the health-check entry.

#3 @SergeyBiryukov
3 months ago

  • Keywords needs-patch added

Just noting the Health Check entry is being worked on in #50038 :)

@ayeshrajans
3 months ago

A preview of the file upload settings debug information

@ayeshrajans
3 months ago

A patch that adds a new "File upload settings" section to Site Health > Debug page. It takes values from PHP INI settings, and also shows the effective file size (min value of the post-max and max-file-size settings).

#4 @ayeshrajans
3 months ago

Oops, I'm sorry I removed your tag @SergeyBiryukov, I submitted an old comment form I suppose. Thanks for the additional links.

#5 @JavierCasares
3 months ago

So, I've been thinking about the ticket and, we can do this for only the "file_upload" directive, but it could also be a good functionality, so for example, if we create a "define" option at the WP-Config like WP_DISABLE_UPLOADS (true, false) we could block the upload thing in all the system. I don't know, but could be useful if some installations cannot have uploads or there are no need for that.

This ticket was mentioned in Slack in #core-site-health by javier. View the logs.


3 months ago

Note: See TracTickets for help on using tickets.