[wp-trac] [WordPress Trac] #63294: Got this error when send image via REST API on WP 6.8

WordPress Trac noreply at wordpress.org
Mon Mar 16 15:03:10 UTC 2026


#63294: Got this error when send image via REST API on WP 6.8
-------------------------------+------------------------------
 Reporter:  Astraport          |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  REST API           |     Version:  6.8
 Severity:  critical           |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by robertgres):

 How does the fact that a PHP installation doesn't support ''processing''
 of a certain image type relate to the server's inability to ''upload'',
 i.e. ''store'' a file?

 If the server is unable to generate various file sizes it shouldn't
 prevent user from uploading valid files.
 Would this lead to users uploading 10Mb images which would show
 unoptimized? - yes, but it's not up to the core function to enforce such
 drastic measures. Emit a warning, for goodness' sake!

 Moreover, why does the error message is hard-coded?
 > Convert it to JPEG or PNG before uploading
 What if we're uploading JPEG or PNG but the real problem is that
 `imagetypes()` doesn't report it as supported?


 To enable behavior prior to WP 6.7, it's possible to use
 `wp_prevent_unsupported_mime_type_uploads` filter:

 {{{#!php
 <?php
 add_filter('wp_prevent_unsupported_mime_type_uploads', function ($prevent,
 $fileType) {
     return !$fileType || !str_starts_with($fileType, 'image/');
 }, 10, 2);
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63294#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list