The MU forums have moved to WordPress.org

Possible to change the image and media upload directory? (9 posts)

  1. boldlygoing
    Member
    Posted 14 years ago #

    Was wondering if anyone has changed the destination directory of where WPMU uploads the various files that are entered via the Post/Page edit page? Ideally, I would like to be able (obviously without core hacking) to be able to set the upload of images to another domain running on the same server as my MU install.

    Subsequently, I'd want the images served to the post page from that alternate domain location.

    Is this even remotely possible without hacking into important things? I've seen a few Amazon Cloud and Steady Offload plugins but they seem to be more than what I'd like.

    TIA for any help or directive advice.

    James.

  2. andrea_r
    Moderator
    Posted 14 years ago #

    Just curious - why a different domain on the *same* server?

  3. tdjcbe
    Member
    Posted 14 years ago #

    "I want mine to just be like wordpress.com!" :)

    Actually we're in the process of moving our installs' blogs.dir directories into a different hosting account. Must like we do that trick with the databases. Makes doing backups a lot easier. (Hopefully at least.)

    We're doing code edits though. I like core edits. :)

    The upload directories get defined here:

    http://trac.mu.wordpress.org/browser/trunk/wp-settings.php#L324

    You should be able to create a mu-plugin and define those before hand. Do note that those paths are file paths and not urls.

  4. andrea_r
    Moderator
    Posted 14 years ago #

    "You should be able to create a mu-plugin and define those before hand."

    Has anyone tried the defines in wp-config yet?

  5. boldlygoing
    Member
    Posted 14 years ago #

    Hey Andrea,

    it's just a performance thing. Most browsers will allow, on default, just a couple of connections to a domain. By "offloading" as many images as possible, they can load in parallel with the main domain's code, html, php, css, js, etc.

    A certain amount of the hard coding I can obviously put in this image serving domain, however I just thought it would be totally groovy to have the default image/media upload function placing those uploads into the directory structure under that image domain.

    Could have swore I looked in WPMU's wp-config.php for mention of upload directory. Guess I couldn't see it right in front of my face! Where it mentions to "remember to change WP_CONTENT too" what exactly does that mean I need to do?

    TIA!!

  6. boldlygoing
    Member
    Posted 14 years ago #

    Any thoughts on "remember to change WP_CONTENT too" line in wp-config.php when attempting to change the upload directory on one's server?

    TIA.

  7. boldlygoing
    Member
    Posted 14 years ago #

    Okee dokee. Guess this one is just too tough.

    Thanks anyway.

    James.

  8. gazouteast
    Member
    Posted 14 years ago #

    James

    I "think" it's referring to this -

    in root/wp-settings.php about 45% of the way down the file


    if( !defined( "UPLOADBLOGSDIR" ) )
    define( "UPLOADBLOGSDIR", 'wp-content/blogs.dir' );

    if( !defined( "UPLOADS" ) )
    define( "UPLOADS", UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );

    if( !defined( "BLOGUPLOADDIR" ) )
    define( "BLOGUPLOADDIR", WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );

    I notice that the " blogs.dir " folder is hard coded in there - Not sure if that should be changed (along with the setting in wp-config.php) BEFORE install or AFTER install - standalone WP logic says do it before, but all the gooroos seem to say don't tinker with those files pre-install

    All very confusing and no hard and fast rules seem to be laid down anywhere.

    Gaz

  9. gazouteast
    Member
    Posted 14 years ago #

    Right - I've tried what I said in my last post as an after install action - copied the defines to wp-config.php and renamed the folders in the server - - - doesn't work, Andrea says htaccess also needs changed (but I have no idea how to do that)

    I'm now contemplating editing wp-config.php AND wp-settings.php BEFORE install and doing another install. If I do though, it'll be WPMU's absolute last chance from me - I'm already mightily p'd off that it's such a difficult beast to even get basic functionality operational.

About this Topic

  • Started 14 years ago by boldlygoing
  • Latest reply from gazouteast