【问题标题】:Need to Upload mht file format to wordpress site需要将 mht 文件格式上传到 wordpress 网站
【发布时间】:2013-08-05 07:49:23
【问题描述】:

我有一些“.mht”文件。我需要将该文件上传到我的 word press 网站。但是当我上传这些文件时,它显示“HTTP ERROR”错误。

有没有其他方法可以将“.mht”文件上传到 word press 网站。

【问题讨论】:

    标签: php wordpress http mhtml


    【解决方案1】:

    您可以在此处使用以下代码将其他文件类型上传到您的 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;
     }
     ?>
    

    因此您可以使用上述代码以这种方式添加文件格式
    有关此问题的更多信息,请访问此link..
    支持 word press 的默认文件格式为 here..

    【讨论】:

    • @chandru 欢迎您。 :D
    【解决方案2】:

    在你的function.php中添加这个

    function custom_upload_mimes ( $existing_mimes=array() ) {
    
        $existing_mimes['mht'] = 'multipart/related';
    
        return $existing_mimes;
    
    }
    add_filter('upload_mimes', 'custom_upload_mimes');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-23
      • 1970-01-01
      • 2014-07-08
      • 2019-03-22
      相关资源
      最近更新 更多