Related articles
- The problem: I’m unable to add a USDZ file to my WordPress media library.
- The solution: How to Fix the “Sorry, This File Type Is Not Permitted for Security Reasons” Error in WordPress
- Add permitted file types by changing the WordPress multisite settings
- Use the upload_mimes filter by editing your theme’s functions.php file
- Modify the approved file types using the plugin
- Summary
Trouble Shooting Guide:
CartMagician Pro for WooCommerce
UUpdated on March 11, 2021
Understanding the ‘file type not permitted’ error in WordPress online shopping sites
The problem: I’m unable to add a USDZ file to my WordPress media library.
When adding USDZ files to WordPress via the CartMagician WooCommerce plugin, you may encounter the following error:
Sorry, this file type is not permitted for security reasons
The reason behind this WordPress error is actually quite straightforward. WordPress has placed restrictions on the types of files you can upload. The “Sorry, this file type is not permitted for security reasons” or “This Mime Type is not Supported” error appears when you try to upload a prohibited file type.
If you’ve tried to upload a USDZ or GLB file to your media library and received the error, you may feel baffled as to how to proceed. Fortunately, there are several ways to fix the error, and continue to add augmented reality content to your site as normal.
In this troubleshooting guide, we’ll show you three ways to solve the error and upload any USDZ or GLB file to your WordPress site.
Let’s get started!
The solution: How to Fix the “Sorry, This File Type Is Not Permitted for Security Reasons” Error in WordPress
Depending on your situation, one of the three methods listed below should solve the problem.
However, some hosting providers limit the file types you can upload. If your hosting provider does this, the methods we’ve listed below won’t solve the error. In this instance, you’ll need to contact your hosting provider for support.
1. Add permitted file types by changing the WordPress multisite settings
A WordPress multisite enables you to create a network of websites with a single WordPress installation. It’s handy if you want to enable users to create their own blogs, or if you’re an international company and want to use subdomains to create country-specific sites that can be updated simultaneously.
Unlike single-site WordPress installations, multisite has a setting that allows you to set permissions for file uploads that are not normally allowed by WordPress.
How to change the multisite network settings
- To access this setting, navigate to “Settings” and then “Network Settings” in the Network Admin dashboard:
- Scroll to the “Upload Settings” heading. Beneath this you’ll find the “Upload file types” setting where you can add the extensions for the file types you wish to permit.
- Add in “.usdz” and “.glb” and save your changes.
- This will update the permitted file types for all the sites in your network, enabling you and your users to upload any file types included in this setting.
2. Use the upload_mimes filter by editing your theme’s functions.php file
You can change your site’s permitted MIME types manually. To do so, you’ll need to access your theme’s functions.php file and utilize a WordPress function known as a ‘filter’.
The functions.php file defines the behaviors, or functions, of your WordPress site. In WordPress, you can use filters to modify the platform’s default functions. By adding the upload_mimes filter to functions.php, you’ll be changing WordPress’s default behavior when you attempt to upload a prohibited file type.
- Access your functions.php file via FTP using an FTP client such as FileZilla or access through your CPanel File Manager.
- Once you’ve connected to your site’s server, you will find your functions.php file inside your theme’s folder located in the wp-content directory. Right-click on the file and select View/Edit.
- The file will open in your text editor, where you can add the following code:
- Add the MIME types and their corresponding extensions to the array. This method enables you to specify which MIME types you want to allow, so you still have control over what’s uploaded to your site to help prevent file upload vulnerabilities.
- Save your changes when you’ve finished editing.
3. Modify the approved file types using the plugin
There are several plugins that enable you to upload prohibited file types, such as File Manager and Enhanced Media Library. These plugins have settings to enable you to add permitted Multipurpose Internet Mail Extensions (MIME) types for upload to WordPress.
A MIME type describes the content a file contains and tells your browser how to display it correctly. For example, the file extension .jpg corresponds with the MIME type image/jpeg and displays as an image in web browsers.
We’ll use the Enhanced Media Library plugin as an example of how to add new permitted MIME types for upload. You can quickly install and activate the plugin within the Plugins area of WordPress.
- With the plugin activated, go to your settings and select “Media” and then “MIME Types”.
- Select “MIME Type Settings”.
- There are two ways to permit uploads for a specific MIME type.
a. The first is to simply select the box corresponding to the desired MIME type in the “Allow Upload” column.
b. If your desired type is not listed, you’ll have to select “Add New MIME Type” at the top of the page.
For USDZ please add the following settings:
- AddType model/vnd.usdz+zip usdz
- Add Mime Type Settings to List
- This will add a new row where you can enter the extension, MIME type, and labels.
- Next, select the “Allow Upload” box for the new MIME type.
If you ever change your mind, you can remove entries by using the button at the end of each row or select Restore WordPress default MIME Types for the original settings.
Summary
WordPress errors can cause setbacks when you’re making changes to your site. However, when it comes to the file types error, there are several solutions available to let you to upload files types that WordPress doesn’t allow by default.
In this guide, we’ve discussed what causes this error in WordPress and why it exists. Then we provided three possible solutions for fixing the error:
- Add permitted file types by changing WordPress Multisite settings.
- Use the upload_mimes filter by editing your theme’s functions.php file.
- Modify the approved file types using a plugin.
If you need further assistance, please log in to your account and submit a ticket to our support team.
Haven't found the answer? We can help.
Submit a requestContact us and we’ll get back to you as soon as possible.