[wp-trac] [WordPress Trac] #39550: Some Non-image files fail to upload after 4.7.1

WordPress Trac noreply at wordpress.org
Fri Feb 24 15:20:04 UTC 2017


#39550: Some Non-image files fail to upload after 4.7.1
-------------------------------------+------------------------
 Reporter:  greatislander            |       Owner:  joemcgill
     Type:  defect (bug)             |      Status:  assigned
 Priority:  normal                   |   Milestone:  4.7.3
Component:  Upload                   |     Version:  4.7.1
 Severity:  critical                 |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+------------------------

Comment (by blobfolio):

 Replying to [comment:113 kontur]:
 > I couldn't find "wp_check_filetype_and_ext" in this reference:
 https://codex.wordpress.org/Plugin_API/Filter_Reference but it seems to
 work anyhow.

 Yeah, I found that one in `wp-includes/functions.php`. Haha.

 {{{#!php
 <?php
 /**
          * Filters the "real" file type of the given file.
          *
          * @since 3.0.0
          *
          * @param array  $wp_check_filetype_and_ext File data array
 containing 'ext', 'type', and
          *                                          'proper_filename'
 keys.
          * @param string $file                      Full path to the file.
          * @param string $filename                  The name of the file
 (may differ from $file due to
          *                                          $file being in a tmp
 directory).
          * @param array  $mimes                     Key is the file
 extension with value as the mime type.
          */
 }}}

 This filter triggers after the main upload file checking, so with that in
 mind just be sure you are only overriding the yay/nay for font files. (It
 is easy to accidentally allow everything or deny everything... oops.)

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


More information about the wp-trac mailing list