WordPress.org

Ready to get started?Download WordPress

Forums

Multisite media (10 posts)

  1. lohic
    Member
    Posted 1 year ago #

    Hello,

    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
    Member
    Posted 1 year 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

    <?php
    
    /*
    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
    Member
    Posted 1 year ago #

    Hello,
    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
    Member
    Posted 1 year 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 :
    http://mydomain.com/wp-content/blogs.dir/6/files/2012/05/myfile.svg

    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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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