上传.dta并在wordpress上执行文件

问题描述 投票:0回答:1

我目前正在建立一个共享统计文件的网站。我正在使用wordpress cms构建它。但是,当我尝试上传扩展名为.dta的文件并执行文件时,会出现此错误

cr-ethdat1997-version3.do:抱歉,出于安全原因,不允许使用此文件类型。

我该如何解决?

wordpress file file-upload content-management-system dta
1个回答
0
投票

[如果您不希望WordPress检查您要上传的文件类型,则可以在wp-config.php文件中添加一个常量:

define( 'ALLOW_UNFILTERED_UPLOADS', true );

否则,如果要检查文件类型,则可以通过以下方式允许某些MIME类型:

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' );

请参阅法典以获取更多详细信息:https://developer.wordpress.org/reference/hooks/upload_mimes/

© www.soinside.com 2019 - 2024. All rights reserved.