0
votes

I am currently building a website for sharing statistical files. I am using wordpress CMS to build it. However, when I try to upload files with extension .dta and do files, it raises this error:

cr-ethdat1997-version3.do: Sorry, this file type is not permitted for security reasons.

How can I resolve it?

1

1 Answers

1
votes

If you don't want WordPress to check what file types you are uploading, you can add a constant in the wp-config.php file:

define( 'ALLOW_UNFILTERED_UPLOADS', true );

Otherwise, if you want file type checking, you could add certain mime types with the following filter:

function my_custom_mime_types( $mimes ) {

    // New allowed mime types.
    $mimes['svg']  = 'image/svg+xml';
    $mimes['svgz'] = 'image/svg+xml';
    $mimes['doc']  = 'application/msword'; 


    return $mimes;
}

add_filter( 'upload_mimes', 'my_custom_mime_types' );

You would need to find the MIME types for the files you'd want to upload (.do, .dta)

Take a look at the Codex for more details: https://developer.wordpress.org/reference/hooks/upload_mimes/