If you’re an avid user of your WordPress blog, you will no doubt have worked with the WordPress Media Uploader before. This is the interface that let’s you upload media such as movies and images, and it saves them all happily in the ‘wp-content/uploads’ folder
If you use it alot, or if you are doing some other WordPress magic, you may come to the point that you want to change that folder.

Ferris Wheel Reflected In A Puddle

Ferris Wheel Reflected In A Puddle

For instance, in my case, for setting up a dual node wordpress installation, where the uploads folder needs to be shared on a different fileserver (I know, there were other solutions possible too). So, how do you go about then?
First of all, a word of advice: this change is not for the faint-hearted, or novices. It involves manually editing the wp-config.php file, and may break your WordPress installation! Normally not beyond repair, but still…

So, you start by opening the file wp-config.php in your favorite text-editor (which is Vi, I know 😉 )
Next, you look for this line of code:

/** Sets up WordPress vars and included files. */^M
require_once(ABSPATH . ‘wp-settings.php’);

And above this you add the line of code that tells WordPress where to save the media uploads:

define( ‘UPLOADS’, ‘wp-content/media’ );

Or, when you want to place the upload directory outside of the wp-content folder:

define( ‘UPLOADS’, ‘media’ );

Since the path is always relative to your WordPress installation, it doesn’t need a leading slash.

As you can see, it was not that hard to change WordPress’ media upload folder, and who knows, maybe one day, you might just find you need to urgently change it!

Share via
Copy link