• I always had my uploaded images in another directory/domain than the default one. The reason to do that is that we have a fileserver and images need to be uploaded there to be available from every webserver while the PHP files are served from local copy on every webserver (they rarely change and need to be as fast as possible).

    Now that I’m experimenting with WordPress 3.0 MultiSite I had to see that it doesn’t seem to be possible to change the upload directory. I can change the setting for every blog (Super Admin / Sites / Blog…Edit), but whatever I do, nothing changes. Files are still uploaded to wp-content/blogs.dir/{id}/…

    That’s a major flaw and should be fixed. Or is there a fix that I don’t see right now?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter blam4c

    (@blam4c)

    Ouch… Just noticed that for the default directory all image requests are routed through a php file that loads the full WordPress engine and checks the database and stuff… Another reason to change the way uploaded images are handled in WPMU…

    Doesn’t seem to be possible easily though. Have found blogs.dir hardcoded in too many places in the source.

    You can define a new wp-content folder in the wp-config file, which would bypass everything else.

    Have a look at some of the Amazon S# offloading plugins to see how they do it.

    Thread Starter blam4c

    (@blam4c)

    I found another solution by adding a sunrise.php to my installation:

    add_filter('upload_dir', 'fix_my_upload_dir');
    
    function fix_my_upload_dir($uploads) {
        $blogdir = [...] find a subdirectory you want to use [...];
    
        $uploads['basedir'] = '/var/www/somedirectory/' . $blogdir;
        $uploads['baseurl'] = 'http://content.bloxxx.net/' . $blogdir;
    
        $uploads['path'] = $uploads['basedir'] . $uploads['subdir'];
        $uploads['url'] = $uploads['baseurl'] . $uploads['subdir'];
    
        return $uploads;
    }

    YES! Forgot to mention sunrise.phph. Handy file.

    This will exactly solve my problem…if I can get it working. Right now I upload an image and insert it into a post. The problem is that it never actually uploads the picture. The path of the picture is correct (if I view the page source), but it is not actually in the directory. I am guessing it is an issue with my $uploads[‘basedir’]. Should this be the path to my upload directory from root?

    Should be the full path on the server.

    I was about to tell you that is what I have for the value…but I checked it right before I replied and noticed I had a typo in the path. So thanks for making me take another look 😉

    Take care…

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Change Upload Directory in Multisite’ is closed to new replies.