WordPress允许上传的类型
一直被这个问题困扰
今天翻了翻functions文件
在2275行看见了function get_allowed_mime_types() 这个方法
里面列举了允许上传的所有类型(见下表)
有几个算比较常用的不在列表
大家可以手动添加进去
比如’jar’ => ‘application/java-archive’
‘m3u’ => ‘audio/x-mpegurl’
‘rar’ => ‘application/x-rar-compressed’
更多请自行查阅MIME类型
‘jpg|jpeg|jpe’ => ‘image/jpeg’
‘gif’ => ‘image/gif’
‘png’ => ‘image/png’
‘bmp’ => ‘image/bmp’
‘tif|tiff’ => ‘image/tiff’
‘ico’ => ‘image/x-icon’
‘asf|asx|wax|wmv|wmx’ => ‘video/asf’
‘avi’ => ‘video/avi’
‘divx’ => ‘video/divx’
‘flv’ => ‘video/x-flv’
‘mov|qt’ => ‘video/quicktime’
‘mpeg|mpg|mpe’ => ‘video/mpeg’
‘txt|c|cc|h’ => ‘text/plain’
‘rtx’ => ‘text/richtext’
‘css’ => ‘text/css’
‘htm|html’ => ‘text/html’
‘mp3|m4a’ => ‘audio/mpeg’
‘mp4|m4v’ => ‘video/mp4’
‘ra|ram’ => ‘audio/x-realaudio’
‘wav’ => ‘audio/wav’
‘ogg’ => ‘audio/ogg’
‘mid|midi’ => ‘audio/midi’
‘wma’ => ‘audio/wma’
‘rtf’ => ‘application/rtf’
‘js’ => ‘application/javascript’
‘pdf’ => ‘application/pdf’
‘doc|docx’ => ‘application/msword’
‘pot|pps|ppt|pptx’ => ‘application/vnd.ms-powerpoint’
‘wri’ => ‘application/vnd.ms-write’
‘xla|xls|xlsx|xlt|xlw’ => ‘application/vnd.ms-excel’
‘mdb’ => ‘application/vnd.ms-access’
‘mpp’ => ‘application/vnd.ms-project’
‘swf’ => ‘application/x-shockwave-flash’
‘class’ => ‘application/java’
‘tar’ => ‘application/x-tar’
‘zip’ => ‘application/zip’
‘gz|gzip’ => ‘application/x-gzip’
‘exe’ => ‘application/x-msdownload’
// openoffice formats
‘odt’ => ‘application/vnd.oasis.opendocument.text’
‘odp’ => ‘application/vnd.oasis.opendocument.presentation’
‘ods’ => ‘application/vnd.oasis.opendocument.spreadsheet’
‘odg’ => ‘application/vnd.oasis.opendocument.graphics’
‘odc’ => ‘application/vnd.oasis.opendocument.chart’
‘odb’ => ‘application/vnd.oasis.opendocument.database’
‘odf’ => ‘application/vnd.oasis.opendocument.formula’