1. Home
  2. Knowledge Base
  3. Troubleshooting
  4. Download is not allowed for this file type

Download is not allowed for this file type

If you encounter the error message “Download is not allowed for this file type” while using the Download Monitor plugin, don’t worry. This error occurs because the plugin performs file extension checks for security reasons, even for files located on remote servers. Certain file extensions such as .php, .html, .htm, and .tmp are restricted and cannot be downloaded.

You can only upload file types which are accepted by WordPress. You can find a list of images, documents, audio and video file types which are accepted here. If you find yourself in a situation where the file you want to upload to your download is not in the list above, there is no need to worry. If you wish to add new types, there is an excellent tutorial which you can find here

There are some plugins which can help you unlock those file types. We recommend the WP Extra File Types plugin. With its help you will be able to add file types to the default list of file extensions supported by the Media Library procedure. 

Starting from version 4.7.75 of the Download Monitor plugin, we’ve introduced a handy filter called dlm_check_remote_extension to provide more flexibility in handling file extensions for remote files. With this filter, you can bypass the extension check and allow downloads of files with these restricted extensions if necessary.

Here’s how to use the dlm_check_remote_extension filter to bypass the extension check:

  • Access Your Child Theme’s Functions.php File: To implement this filter, you’ll need to add some custom code to your WordPress child theme’s functions.php file.
  • Add the Filter Code: Open your child theme’s functions.php file and add the following code snippet:
add_filter( 'dlm_check_remote_extension', '__return_false' );

This code snippet sets the filter to return false, which effectively bypasses the extension check for remote files. It allows files with restricted extensions to be downloaded without any issues.

By applying this filter in your child theme’s functions.php file, you grant the necessary permissions to download files with extensions like .php, .html, .htm, and .tmp from remote servers. This can be particularly useful if you have legitimate use cases for such file types.

In summary, the “Download is not allowed for this file type” error can be easily addressed by adding the dlm_check_remote_extension filter to your child theme’s functions.php file, enabling you to customize the handling of file extensions and ensure smoother downloads for your users.

Was this article helpful?
Start Protecting your WordPress Downloads

Protect and track downloads on WordPress... What are you waiting for?