Multisite media (10 posts)

  1. lohic
    Posted 3 years ago #


    I'm trying to configure a wordpress multisite.
    Currently that works on almost everything but I have an issue with some media file.

    In my template I hadded a filter

    add_filter('upload_mimes', 'addUploadMimes');
    if( ! function_exists ( 'addUploadMimes') ) {
    	function addUploadMimes($mimes)
    		$mimes = array_merge($mimes, array(
    			'svg' => 'image/svg+xml'
    		return $mimes;

    to authorize image/svg+xml upload (I need to do some interactive diagram).
    Everything works fine in a standard wordpress (I load my file in an object tag), but in my multisite config the file is automatically downloaded. I guess that the problem come from the ms-files.php and the multisite HTACCESS file.

    Is there any solution to have this file showed normally ? I assume the problem is the same for swf, or maybe mp3 file ? (I didn't tested).

    Thanks in advance.

  2. lohic
    Posted 3 years ago #

    I forgot to say that my standard images are showing correctly (jpg, gif, png).

  3. In my template I hadded a filter

    Where's this? Your function.php?

    Better to put this in the wp-content/mu-plugins/ folder

    Plugin Name: Sitewide Functions
    Author: lohic
    add_filter('upload_mimes', 'add_custom_upload_mimes');
    function add_custom_upload_mimes($existing_mimes){
     $existing_mimes['svg'] = 'image/svg+xml'; //allow svg files
     return $existing_mimes;
  4. lohic
    Posted 3 years ago #

    and thanks for your response. I'll make the plugin and tell you what happen !
    I don't find any mu-plugins folder only plugins.
    Is it normal (I use wordpress multisite and not the wordpress Mu extension)

  5. lohic
    Posted 3 years ago #

    Ok, I made the plugin, I can upload SVG as before, but when i'm going on my page the file still download instead of showing.
    I'm using this syntax :
    <object id="svg-13927" width="100%" height="100%" data="http://www.mydomain.com/files/2012/05/myfile.svg"></object>

    But the real file URL is :

    It seems that ms-files.php force it to download with a php header. Is there a way to change that without editing ms-files.php ?

  6. Ugh.

    No. In 3.5, we do away with the ms-files stuff, but in your case, you may either have to wait for that or continue to use the full path.

  7. lohic
    Posted 3 years ago #

    Ho ok,
    It's a good news that this method fill stop with the 3.5.
    Have you any idea about the release date, or where I can find some info on it. By this way we'll be able to get roadmap....

    Thanks again.

  8. lohic
    Posted 3 years ago #

    Oups sorry, just saw the wordpress roadmap and the 5 december 2012 fore the 3.5 release.
    I think we'll be able to wait for this functionality.

  9. You could try it on Beta 1 for now?

  10. lohic
    Posted 3 years ago #

    Ok, as soon as I have a little time, I'll test it a say you how it works !

Topic Closed

This topic has been closed to new replies.

About this Topic