The MU forums have moved to WordPress.org

Problems Configuring Custom WPMU Upload Paths. (16 posts)

  1. NEMESISbyDesign
    Member
    Posted 4 years ago #

    Hello Wordpress community!

    This is my first time posting here but I have used WP for years. However, I only just began using WPMU.

    I have a question about upload paths in WPMU.

    I apologize if this has already been answered as I have extensively searched WP and Google for days prior to posting.

    I need to change my Upload Path:

    wp-content/blogs.dir/#/files

    to a sub domain like this:

    http://uploads.mydomain.com/#

    Where # = the individual blogID.

    Doing this in the blog/edit does not change the upload location.

    I understand upload quotas may not work and that’s ok as this is a private blog network.

    The reason I want to achieve this is because as the blog grows we want to be able to host the media on a separate server.

    I am using WPMU 2.8.6 on a Linux box, Apache 2.2.14, PHP 5.2.12, MYSQL 5.0.85 with a cPanel/WHM setup.

    I apologize in advance if I left anything out.

    Thanks again for being such a amazing community!

    Happy New Year!

    LK

  2. NEMESISbyDesign
    Member
    Posted 4 years ago #

    Happy New Year WP!

    2 more grueling days of searching for a answer on this.

    I have been modifying the following files based on another article that I found (http://mu.wordpress.org/forums/topic/13902)

    .htaccess
    wp-settings.php
    admin/includes/mu.php
    wp-includes/wpmu-fuctions.php

    All I have managed to figure out is that I can change

    wp-content/blogs.dir/1/files
    to
    wp-content/blogs.dir/1/uploads
    (with success)

    However, I still cannot achieve the desired requests which is get the upload <dir> out of the <wp_content>.

    wp-content/blogs.dir/1/files
    to
    /home/####/public_html/uploads/blog_id

    I find it hard to believe that this is such a daunting task, seems to me that this wouldn’t be that farfetched of thing to want to do for many different reason not to mention it is extremely easy in the single WP installation and beneficial.

    I am also not to excited about having to mod the core files to achieve this as this changes will be overwrote each time WPMU is updated. IMO this should be easy to set using the <site admin> master options. I also do not understand why the {blog_id} has the ability to change (although it has no effect) the {Upload Path} under Edit Blog when these should be governed by the master options.

    I have found numerous unresolved post out there all trying to achieve the ability to change the upload path without a lot of core hacks. It would be nice to be able to answer this and help a lot of other fellow WPMU users out there :)

    Any thoughts, suggestions, concerns, are highly appreciated.

    LK

  3. andrea_r
    Moderator
    Posted 4 years ago #

    Did you define the new upload path in wp-config?

  4. vested1
    Member
    Posted 4 years ago #

    Wow -- if someone does resolve this issue please post the resolution. I am using a theme that utilizes TimThumb to produce images on the front page and archive pages. Every time I want an image to appear on the front page, I have to add a Custom Field called "thumb" and then point to the correct directory /wp-content/blogs.dir/1/files/2010/01/ etc which makes it somewhat confusing for several users meaning I need to be vigilant about keeping some of the posts updated.

    Now if all the uploads were to go to one specified location, it would make a lot easier to explain to those that do not realize that there is a month and year thing involved here... instead of switching say 2010/01/ to 2009/11/ they are simply uploading the duplicate files... very messy indeed

  5. andrea_r
    Moderator
    Posted 4 years ago #

    "Every time I want an image to appear on the front page, I have to add a Custom Field called "thumb" and then point to the correct directory /wp-content/blogs.dir/1/files/2010/01/ etc which makes it somewhat confusing for several users meaning I need to be vigilant about keeping some of the posts updated."

    Then you fix how the theme is calling the thumbnails, not screw around with MU. :)

    http://www.binarymoon.co.uk/2009/10/timthumb-wordpress-mu/

  6. NEMESISbyDesign
    Member
    Posted 4 years ago #

    Greetings andrea_r,

    I was looking forward to catching your interest with this post. Through my searching the forums I have read a lot of your post and I am impressed with your level of contribution.

    I also want to clarify, because it appears that what I am hoping to achieve is being misunderstood, at least by vested1.

    I am not looking to dump all the images into one directory. I actually find the </2010/01/> handy.

    My main goal here is to change the default media upload parent directory…

    /home/####/public_html/wp-content/blogs.dir/blog_id/2010/01/img.jpg
    To
    /home/####/public_html/uploads/blog_id/2010/01/img.jpg

    (I included the full server path to show relation)

    As for your question andrea_r, no, I have not changed this in wp-config.php and after examining wp-config.php I could not locate a value to change in relation to the upload path.

    Thank you again for your continued interest.

    LK

  7. andrea_r
    Moderator
    Posted 4 years ago #

    "As for your question andrea_r, no, I have not changed this in wp-config.php and after examining wp-config.php I could not locate a value to change in relation to the upload path."

    Because you have to add it if you want something other than the default. :)

    http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content

  8. NEMESISbyDesign
    Member
    Posted 4 years ago #

    Looks like exactly what the Dr. ordered! I will not be able to play around with it until this weekend but I will be sure to update this thread when I do.

    Thanks again andrea_r!

    LK

  9. andrea_r
    Moderator
    Posted 4 years ago #

    there might still be issues

    http://core.trac.wordpress.org/ticket/11742

  10. NEMESISbyDesign
    Member
    Posted 4 years ago #

    Thank you again andrea_r, you latest post helps explains why this is still unresolved on so many post out there.

    Just for fun I went ahead and tried the suggested changes to the wp-config.php without success. :(

    Unfortunately, it looks like I may have to wait until milestone 3 for WPMU to work right for me.

    Real bummer as I was really hoping to consolidate a lot of my blogs and cut my upgrading time down.

    Thanks again for your effort.

    LK

  11. andrea_r
    Moderator
    Posted 4 years ago #

    "My main goal here is to change the default media upload parent directory…

    /home/####/public_html/wp-content/blogs.dir/blog_id/2010/01/img.jpg
    To
    /home/####/public_html/uploads/blog_id/2010/01/img.jpg"

    Can I ask why? MU does this to keep uploads for each blog in its own folders. Then if you export one a blog, you'd only get the uploads for just that blog.

    All blog uploads in one folder is an outright mess. (I've seen it - as a bug in FCK Editor, the image upload there drops all user's uploads in the "old" wp-uploads folder. Quite trying to sort it out when one users just wants their pictures.)

  12. NEMESISbyDesign
    Member
    Posted 4 years ago #

    Afternoon andrea_r,

    The main reason why is for the ability to move all media (images, movies, etc…) off to separate server array if the need presents itself.

    I run several single install WP’s where I have the images uploaded to http://uploads.mydomain.com and this works very well for what I need it to do. It also serves well in breaking down analytics.

    All blog uploads in one folder is an outright mess

    I am/was planning on maintaining the blog_id for each individual blog

    IE…
    Blog 1 = /home/####/public_html/uploads/1/2010/01/img.jpg"
    Blog 2 = /home/####/public_html/uploads/2/2010/01/img.jpg"
    Blog 3 = /home/####/public_html/uploads/3/2010/01/img.jpg"
    Blog 4 = /home/####/public_html/uploads/4/2010/01/img.jpg"
    Blog 5 = /home/####/public_html/uploads/5/2010/01/img.jpg"

    Thus all blogs will still maintain an individual ID but they will be consolidated into a single <uploads> directory that I can optimally control the server destination with a DNS change.

    LK

  13. andrea_r
    Moderator
    Posted 4 years ago #

    Still don't see how that is any different than the current setup. :) Whether blogs.dir or /uploads? that's almost the same setup.

    other people have successfully off-loaded uploads to places like Amazon s3. Via plugins.

  14. NEMESISbyDesign
    Member
    Posted 4 years ago #

    Almost, but like that say close only counts in horseshoes, hand grenades and thermal nuclear weaponry :)

    The difference is that <uploads> is in the parent <dir> not inside the WPMU <dir>

    IE…

    root
    -wpmu_dir
    --wp-content
    ---blogs.dir
    ----blog_id

    vs

    root
    -uploads
    --blog_id

    The way I have my single WP’s setup is with the <uploads> is setup as a sub domain where if I need to due to bandwidth limitations I can create an A record to control the destination to our media server where the bandwidth is significantly higher.

    Considering plugins, Some plugins I agree we can’t live without, but like the single WP installs I wish this could be accomplished within the WPMU without the dependency on 3rd party plugs or core mods. You know the old song and dance, the more you have to mod to achieve the desired results the more you have to keep moding to keep them. I wish to stay as basic as possible. :)

    This really should be easy to set using the <site admin/edit options {Upload Path} {Upload URL}> just like single WP, since this doesn’t work why is it even an option in edit_options?

    The ability to redirect the <uploads> dir to is essential for our future expansion.

    LK

  15. DennisSmolek
    Member
    Posted 4 years ago #

    I have no idea why they made it so you couldn't easily change this.. its a real pain. I plan on using Rackspace's CloudFiles and I figured it out.. I have't tested it live yet though...

    but so you know it is here:
    line 370 of WP-settings.php

    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/" );
    '

    this creates the upload path if you do not set it in WP-config on line 94:

    // uncomment to move wp-content/blogs.dir to another relative path
    // remember to change WP_CONTENT too.
    // define( "UPLOADBLOGSDIR", "fileserver" );

    They dont list the UPLOADS here as on WP single it's changeable..
    So what you do is uncomment and define UPLOADBLOGSDIR to uploads
    and it will still add the date if you have it set up to.. Also, by defining UPLOADS you dont need to do the string replace on that value before hand to remove the files path..
    so in your example add this to your wp-config.php

    define( "UPLOADBLOGSDIR", "uploads" );
    define( "UPLOADS", UPLOADBLOGSDIR . "/{$wpdb->blogid}/" );

    then your files should go to for example:
    /home/####/public_html/uploads/1/2010/01/

    I would love to know how you handle scaling of your file system even though its under a local directory.. I was thinking of editing the upload function to work with rackspace, and simply editing the direct file name.. IE (blog_id)_(user_id).filename.jpg
    or something.. still in the works..

  16. DennisSmolek
    Member
    Posted 4 years ago #

    woops, I also read that you are not storing WPMU in the root.. Read this to move:
    http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content

    I think adding $_SERVER['DOCUMENT_ROOT'] . should pull you to
    home/users/whatever/
    then you have to add /public_html to get to your sites "root" directory.. Not your servers though..
    so it would be

    define( "UPLOADBLOGSDIR", $_SERVER['DOCUMENT_ROOT'] ."/public_html/uploads" );

    remember when you put a preceding forward slash it thinks its ROOT
    so the path goes there first.. I've never tested this on a server I didn't have root access to..
    let me know if this works!!

About this Topic

  • Started 4 years ago by NEMESISbyDesign
  • Latest reply from DennisSmolek