[wp-trac] [WordPress Trac] #20997: Multisite not honoring upload_filetypes

WordPress Trac wp-trac at lists.automattic.com
Sun Jun 17 14:20:30 UTC 2012


#20997: Multisite not honoring upload_filetypes
--------------------------+-----------------------------
 Reporter:  Ipstenu       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Multisite     |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 It was a myriad error filled day. Once I kicked PHP into shape, I couldn't
 upload epubs (though everything else 'normal' worked). I got the age old
 error "Sorry, this file type is not permitted for security reasons."

 I checked in Network -> Settings -> Network Settings, where I've set
 "Upload file types" to the following (bolded the ones I added):

 jpg jpeg png gif mp3 mov avi wmv midi mid pdf '''m4v flv ogv docx epub zip
 ico txt'''

 But that didn't work until I added this in a function (mu-plugin function,
 whatever)

 {{{
 add_filter('upload_mimes', 'add_custom_upload_mimes');
  function add_custom_upload_mimes($existing_mimes){
  $existing_mimes['epub'] = 'application/epub+zip'; //allow epub files
  return $existing_mimes;
  }
 }}}

 So okay, that ain't right! I reproduced it on a clean build. Every time I
 add in the filter, it will magically work.

 Now I know this worked on trunk in May, so I double checked the last
 changes to ms-functions.php (since that's where it has the nifty function
 check_upload_mimes() which looks at those settings) which has had no
 changes that should have impacted anything to do with this.

 The weird thing is that this doesn't impact ''all'' file types. If I add
 'zip' it works fine, but I have to force set epub (and mobi, and a couple
 others I made up). From what I can tell, these will always work: '''m4v
 flv ogv docx zip ico txt'''

 But epub, mobi, bla (my fake one) always fail without the filter.

 Tested it on php 5.3.13, 5.3.14, and 5.3.6

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20997>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list