我有一个老同学,他想把excel文件上传到我们的Wordpress页面。
基本上,Wordpress不允许这样做。
在上面
https://gist.github.com/robwent/e3bf00bafe7a00bc3d0c4dceabde4fca
我将以下内容放入函数中。结束前的php“包括”:function my_custom_mime_types( $mimes ) {
// New allowed mime types.
$mimes[\'xls\'] = \'application/vnd.ms-excel\';
return $mimes;
}
add_filter( \'upload_mimes\', \'my_custom_mime_types\', 9999 );
但在上传时。xls文件我收到一条错误消息,由于安全原因,这是不允许的(从我的母语重新翻译)。这是一次正确的尝试吗?我怎样才能做到这一点?