How to Manage and Control File Downloads in WordPress
If you’re making documents available for downloading through your WordPress website, you’ll need a way to manage and control file downloads. This is particularly useful if you want only a certain number of people to have access to the downloadables or grant access for a limited time only.
With this in mind, in this article, we’ll take a closer look at why you might need to manage and control file downloads in WordPress. We’ll also walk you through a step-by-step tutorial explaining how you can manage and control file downloads using the Filr plugin.
Controlling file downloads in WordPress
Controlling file downloads simply means granting users permission to download files and documents from your site. There are two main ways to control file downloads:
- You want to make a certain number of document downloads available to users.
- You want to have document downloads automatically expire by a certain date.
Let’s say you’re running an online membership site or training program for which you enroll a maximum of 200 members. You can make documents and resources available to your site’s members while making sure unauthorized users don’t gain access to them. One way to do this is by offering only 200 file downloads. In other words, the documents and resources will not be available for download after the first 200 people download them.
This is also great for online businesses that need to create limited-time offers. For example, you can make coupon codes available to the first 100 users. After 100 people download the coupon, it’ll automatically expire and won’t be available for download.
Another way to control file downloads in WordPress is by setting files to expire by a certain date. For example, if you’re organizing an event, you might want to close registrations by a specific date, say, two weeks before the day of the event. In this case, you can have your event registration form automatically expire two weeks before the day of the event. Similarly, if you’re running a membership site, you can set documents to automatically expire after the membership period.
How to manage and control file downloads in WordPress using Filr
The easiest way to manage and control file downloads in WordPress is by using a plugin like Filr. Here’s what you need to do to get started:
Step #1: Install and activate the Filr plugin
Filr lets you upload, protect, and share files in a safe and secure way. You can use it to make a certain number of document downloads available to users or have document downloads automatically expire by a certain date.
The free version of the plugin lets you display downloadable documents on your site’s front-end in a table. However, for managing and controlling file downloads, you’ll need to get the pro version.
So, to get started, get the Filr plugin and install and activate it on your WordPress website. Once the plugin is activated, you’ll see a new menu item added to the sidebar menu called Files.
Step #2: Create a list to organize your files
With Filr installed on your WordPress site, the first thing you need to do is create a list to organize your files. This helps you keep things organized on your site’s back-end and makes it easy to stay on top of the files you make available for download.
Go to Files > Lists from the WordPress admin panel. On the Lists screen, enter a name and description for the new list.
Click the Add New List button to proceed. The new list will automatically be added to the list table on the right. You’ll notice that a new shortcode is generated for it.
We’ll use this to display the files on the front-end. For now, copy it to your clipboard.
Step #3: Upload your files to WordPress
Now, we can start uploading files to our website. Filr automatically stores all files you upload to your site in a secure folder instead of the Media Library. This ensures that unauthorized users can’t access the files directly.
With Filr, there are two ways to make files available for download:
- Individual files. This means that a single file is downloaded when the user clicks the download file button. This is useful for when you need to let users download a single document or let users choose which documents they’d like to download.
- Multiple files. If you upload multiple files to a single new file in Filr, the plugin will automatically create a zip file and generate a matching download link. When a user downloads the file archive, all of the files in the archive will be downloaded in one go. This is useful for when you need users to download multiple related files.
Go to Files > Add New and enter a title for the files. Use the File Upload metabox to upload the file (or files) to your website. Select the list you created in Step #2 from the Lists metabox in the sidebar.
Use the Advanced Options metabox to either expire the file(s) by date or by the number of downloads. In addition to this, you can also choose to encrypt the filename by toggling the Encrypt Filename setting on.
Click the Publish button to continue.
Step #4: Protect your files (optional)
Depending on the types of files you’re making available for download, you might want to take steps to protect them from unauthorized users. Filr offers three different document protection settings:
- No protection. This is the default protection type and is perfect for website owners that want to make documents free to access.
- index.php. When you enable this protection type, Filr creates an index.php file on the root of your uploads directory. This will hide the content of your whole download directory.
- .htaccess. When you enable this protection type, Filr prevents people from browsing your uploads directory and returns a 403 code (Forbidden Access).
To configure Filr protection settings, head over to Files > Settings and click on the Status tab.
Tick the radio button next to the protection mode you’d like to apply to your files. You can also click the Check directory protection link to check the status.
Click the Save Changes button to proceed.
Step #5: Let users download the files
The final step is to display the downloadable files on the front-end so users can download them.
Go to Pages > Add New and give your page a title. Next, add a new shortcode block to the text editor and paste the shortcode you copied to your clipboard in Step #2. Click the Publish… button and preview the page on your site’s front-end.
To customize the look and feel of the front-end file table, head over to Files > Settings > Shortcode.
Managing and controlling file downloads using a plugin like Filr takes a lot of the manual work off your plate.
You can either upload files individually or in groups depending on your specific needs. In addition to this, you can control file downloads either by making a certain number of document downloads available to users or having document downloads automatically expire by a certain date.