「.mht」ファイルがいくつかあります。そのファイルを自分のワード プレス サイトにアップロードする必要があります。しかし、そのファイルをアップロードすると、「HTTP ERROR」エラーが表示されます。
「.mht」ファイルをワードプレスサイトにアップロードする他の方法はありますか?
以下のコードを使用して、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;
}
?>
したがって、上記のコードを使用して、この方法でファイル形式を追加できます。
この問題に関する詳細については、このリンク
を参照してください。
ワード プレスをサポートするデフォルトのファイル形式はこちらです。
これを function.php に追加します
function custom_upload_mimes ( $existing_mimes=array() ) {
$existing_mimes['mht'] = 'multipart/related';
return $existing_mimes;
}
add_filter('upload_mimes', 'custom_upload_mimes');