当我尝试上载*.prc
文件类型,我得到以下错误:
抱歉,出于安全原因,不允许使用此文件类型。
我怎样才能解决这个问题?
当我尝试上载*.prc
文件类型,我得到以下错误:
抱歉,出于安全原因,不允许使用此文件类型。
我怎样才能解决这个问题?
This article 解释一种方法,在该方法中,可以将文件类型添加到允许的文件类型列表中。
将以下代码复制并粘贴到functions.php
:
add_filter(\'upload_mimes\', \'custom_upload_mimes\');
function custom_upload_mimes ( $existing_mimes=array() ) {
// add your extension to the array
$existing_mimes[\'prc\'] = \'application/x-mobipocket-ebook\';
// add as many as you like
// and return the new full result
return $existing_mimes;
}
我没有测试代码,但我希望它能帮助您。在主题中添加以下代码functions.php
文件我已经测试了代码,并且工作正常。
// Add the filter
add_filter(\'upload_mimes\', \'custom_upload_mimes\');
function custom_upload_mimes ( $existing_mimes=array() ) {
// Add file extension \'extension\' with mime type \'mime/type\'
$existing_mimes[\'prc\'] = \'application/x-mobipocket\';
// and return the new full result
return $existing_mimes;
}
有关更多信息,请参阅this codex page.我想将所有附件(媒体)存储在以每个帖子标题命名的文件夹中。示例:/wp-content/uploads/my-post-about-stuff/文件夹应包含该帖子所附的所有媒体。这可能吗?