How to Fix Error in WordPress, “Sorry You Are Not Allowed to Upload this File Type”

Collapse

Unconfigured Ad Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Ryaan J.
    Senior Member
    • Apr 2022
    • 103

    How to Fix Error in WordPress, “Sorry You Are Not Allowed to Upload this File Type”

    Hello,

    Please help me to solve this error in WordPress, “Sorry You Are Not Allowed to Upload this File Type”
  • Delaney martin
    Senior Member
    • Jun 2022
    • 102

    #2
    The error "Sorry, you are not allowed to upload this file type" in WordPress occurs when you try to upload a file type that is not allowed by WordPress's default settings.

    Please follow the below steps which helps you to solve these error.


    1. Allowed File Types in wp-config.php

    You can enable unfiltered uploads to allow all file types:
    1. Inside your cPanel's File Manager, open the wp-config.php file.
    2. Add the following code before the line /* That's all, stop editing! Happy publishing. */:
      define('ALLOW_UNFILTERED_UPLOADS', true);
    3. Save the file and try uploading again.
    2. Modify the upload_mimes Filter


    You can explicitly allow specific file types by adding a code snippet to your theme’s functions.php file:

    Code:

    function custom_upload_mimes( $mimes )
    {
    $mimes['svg'] = 'image/svg+xml';
    $mimes['json'] = 'application/json';
    }

    add_filter( 'upload_mimes', 'custom_upload_mimes' );


    Replace 'svg' and 'json' with the MIME types of the file you want to upload.


    Comment

    Working...
    X