我相信您可以在upload_mimes
限制为某些类型。挂钩:http://adambrown.info/p/wp_hooks/hook/upload_mimes
过滤器:
add_filter(\'upload_mimes\',\'restict_mime\');
function restict_mime($mimes) {
$mimes = array(
\'jpg|jpeg|jpe\' => \'image/jpeg\',
\'gif\' => \'image/gif\',
\'png\' => \'image/png\',
);
return $mimes;
}
据我所知,这对管理员或具有
unfiltered_upload
能力。也看看这个帖子
Limit image upload to one and disable audio, video and other document file types to upload控制大小限制的另一种方法是使用。htaccess或php。ini:
对于上载限制,您可以在中设置。htaccess以下选项之一;
LimitRequestBody 1073741824 //( 1MB)
php_value upload_max_filesize 1M
php_value post_max_size 1M
对于php。ini您可以设置
upload_max_filesize = 1M