How to Directly Add Files from the Server into WordPress

Posted on

The WordPress file upload screen allows you to insert media images, videos, or audio into your posts either one at a time or as a bulk upload. For the most part, this works great and very few people require anything more. Especially if you’re building up your blog one post at a time and this is the first location you’ve ever had. But what if your library files are already residing elsewhere on your server? What if you have multiple sites and you wish to import the entire library of media from one site into the other? While there is already an “uploads” folder within the “wp-content” directory within WordPress, merely placing a file inside it means nothing. For it to appear amongst the list of media files that you can choose to insert into a post, it needs to be added via the library interface within WordPress.

This presents a problem if you have a large number of media files. Imagine downloading potentially gigabytes of data onto your local PC and then bulk uploading them to WordPress. It’s a waste of bandwidth as well as time. Not to mention that if something goes wrong in between, you have no way of knowing what failed and what succeeded without painstakingly going through the entire list one by one. Needless to say, this is a very poor solution. Fortunately, you can directly add files from the server into WordPress using a simple plug-in.

Using the “Add From Server” Plugin

After installing the plugin, the first thing you want to do is to craft the permissions to decide who gets to upload in bulk. This can be a major operation and you don’t want to give the ability to just about anyone on your site. Moreover, this exposes your directory structure since the plug-in has to navigate your hosting account to locate the files on your server. So unless you’re the only user, this is something you should take care of at the start.

The “Add From Server” options page can be found under “Settings”.

allow users to upload files

As you can see above, you can open up the functionality to everyone, restrict it to those who have upload permissions within certain rules or in the whitelist box. As a bonus, you can also restrict directory browsing to a specific folder.

Uploading Files in Bulk

Once you’ve set the permissions, you can access the functionality itself under the “Media” menu item from the WordPress dashboard.

add from server menu

Here you can navigate to whichever directory contains the files that you want to upload. A few quick links are provided so you can immediately jump to the uploads folder, the wp-content folder, or the root itself.

select files to upload

In this test example, several versions of an image have been created by WordPress which obviously don’t appear in the library. Let’s use this tool to add them all as well as an audio file which already exists. We’ll see how the plug-in handles duplicates.

Once you click the “Import” button, the process begins. As you can see below, it gives you a confirmation for each file added as well as those that are rejected. For example, the audio file that we included in the first step is skipped over because the library already contains it.

upload complete

Because all of these files are coming directly from the server, there is no need for any uploading or downloading and the entire process takes place very quickly. As you can see below, all of the sample images have been added to my WordPress library as expected.

samples added

I’m thinking that this plug-in could really be of use in a multiuser environment where one person selects images for use by all the others, and places their choices in a specific directory from which the others can pick them up. Especially useful when there are issues of copyright involved and only “safe” images have to be included in posts.

6 Comments on “How to Directly Add Files from the Server into WordPress”!

  • BE AWARE! This plugin doesn’t work properly, as soon as you try to add something over 1000 images it won’t do it, it won’t even tell you what is wrong.
    Also it occasionally stops half way trough the batch….

    • Have you found another solution? I have 24,000 images uploaded to server by ftp. Now I have to bring them into WordPress.

  • Does it just create a link or does it duplicate the content? This could get costly for video and audio.

    • The plugin specifically states, ” Note: All files are copied to the uploads directory.” I found this article while looking for an alternative to this plugin. I’ve had great success with it, but my whole point is to use what’s already there. Besides, I don’t have the server space to handle duplicates.

    • Just did a little experimenting with this and it *does* put the files in the upload folder, but it will use the one you specify in your settings. I’ve just used Add from Server to import several images from my specified media folder, which is not the default, and it maintained the directory structure. In short, it does NOT duplicate the files. Yay!

  • Anyone looking for an alternative to “Add From Server”, you can try “Media Sync” : https://wordpress.org/plugins/media-sync/.

Leave a Reply

Your email address will not be published. Required fields are marked *