我有一些".mht"文件。我需要把那个文件上传到我的word新闻网站。但当我上传那个文件时,它显示"HTTP错误"错误。
有没有其他方法可以将.mht文件上传到word新闻网站。
您可以使用下面的代码将其他文件类型上传到您的WordPress博客。
<?php
add_filter('upload_mimes', 'custom_upload_mimes');
function custom_upload_mimes ( $existing_mimes = array() ) {
// add your extension to the array
$existing_mimes['ppt'] = 'application/vnd.ms-powerpoint';
// or: $existing_mimes['ppt|pot|pps'] = 'application/vnd.ms-powerpoint';
// to add multiple extensions for the same mime type
// add as many as you like
// removing existing file types
unset( $existing_mimes['exe'] );
// add as many as you like
// and return the new full result
return $existing_mimes;
}
?>
因此,您可以使用上述代码以这种方式添加文件格式
有关此问题的更多信息,请访问此链接
此处为支持word press的默认文件格式
将其添加到您的函数中。php
function custom_upload_mimes ( $existing_mimes=array() ) {
$existing_mimes['mht'] = 'multipart/related';
return $existing_mimes;
}
add_filter('upload_mimes', 'custom_upload_mimes');