How to Upload Additional File Types in WordPress Media Library

How to Upload Additional File Types in WordPress Media Library

How to Upload Additional File Types in WordPress Media Library 1

Want to upload more file types to your WordPress media library?

You must have noticed that WordPress doesn’t let you upload all file types via media uploader due to security reasons. You can only upload certain files, like images (.jpg, .png and .gif), documents (.doc, .xls, .ppt, .pdf), audio files (.wav, .mp3, .mp4) and videos (.mpg, .mov, .wmv).

But at times you might want to upload more file types to your WordPress site, like .bmp images, .psd, .ai, .page documents, etc.

Let’s check out how to securely upload additional file types to your WordPress media library.

How to Enable Additional File Upload Support in WordPress

You can extend your WordPress media library support for more file extensions in 2 ways.

  • Method 1: Upload Additional File Type With a Plugin
  • Method 2: Upload Additional File Type Without a Plugin

Method 1: Upload Additional File Type With a Plugin

To enable additional file upload support in WordPress with a plugin, you’ll first need to install and activate the free File Upload Types plugin.

file upload types, additional file support in wp

With this plugin, it’s easy for you to extend your website’s support for more file types.

The plugin works by letting you adjust the internal file whitelist. You can manually control which types of file extensions your site can upload.

Configuring the File Upload Types Plugin

Once the plugin is installed and activated on your WordPress website, go to Settings » File Upload Types

File Upload Types by WPForms , addition file support in wordpress

You’ll see a list that shows you different file formats. To extend the support for more file types, you can select the right file extensions in the list. If you don’t see the file extension that you want to upload, scroll down until you find Add Custom File Types. Then add the details in there.

File Upload Type, WPForms

If you want to extend the support for more than one file type, use the ‘+’ symbol next to the Extension field. Once done click on the Save Settings button at the bottom of the screen. You should now be able to upload your desired file format easily.

Method 2: Upload Additional File Type Without a Plugin

If you don’t want to install a plugin to upload additional file types, simply add this code snippet to your functions.php file or your site-specific plugin.

 function my_myme_types($mime_types){
          $mime_types['svg'] = 'image/svg+xml'; //Adding svg 
extension
    return $mime_types;
}
add_filter('upload_mimes', 'my_myme_types', 1, 1);

In the above code, you’ll notice that the file extension goes as the key in $mime_types associated array and the mime type goes as its value. In this example, the svg file extension represents files with the mime type image/svg+xml.

If you want to add multiple file types you can do that by using this:

function my_myme_types($mime_types){
    $mime_types['svg'] = 'image/svg+xml'; //Adding svg extension
    $mime_types['psd'] = 'image/vnd.adobe.photoshop'; //Adding photoshop files
    return $mime_types;
}
add_filter('upload_mimes', 'my_myme_types', 1, 1);

Once done, don’t forget to save your settings.

We hope this post helped you upload additional file types to your WordPress media library. You might also want to read about the best file upload plugins for WordPress.

Keep reading the article at IsItWP – Free WordPress Theme Detector. The article was originally written by Editorial Team on 2020-03-18 07:34:58.

The article was hand-picked and curated for you by the Editorial Team of WP Archives.

Disclosure: Some of the links in this post are "affiliate links." This means if you click on the link and purchase the product, We may receive an affiliate commission.

Leave a Comment

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

Show Your ❤️ Love! Like Us
Scroll to Top