in WordPress

Change WordPress Upload Mime Types

In the current Wordpress install you are allowed to upload the following file types. You are only able to upload one of the following types. If the file you are trying to upload is not one of the following it will not upload. Wordpress You are currently allowed to upload images, documents, audio and video. Here are the current file formats you are allowed to upload.

Images

  • .jpg
  • .jpeg
  • .png
  • .gif

Documents

  • .pdf (Portable Document Format; Adobe Acrobat)
  • .doc, .docx (Microsoft Word Document)
  • .ppt, .pptx, .pps, .ppsx (Microsoft PowerPoint Presentation)
  • .odt (OpenDocument Text Document)
  • .xls, .xlsx (Microsoft Excel Document)

Audio

  • .mp3
  • .m4a
  • .ogg
  • .wav

Video

  • .mp4, .m4v (MPEG-4)
  • .mov (QuickTime)
  • .wmv (Windows Media Video)
  • .avi
  • .mpg
  • .ogv (Ogg)
  • .3gp (3GPP)
  • .3g2 (3GPP2)

    If the file that you want to upload is not in the above list then you will not be able to upload the file. ## Add Additional Mime Types

    If the file you want to upload isn't one of the above then you can add a function into your functions.php file to allow Wordpress to allow additional mime types.

    
    
    add_filter('upload_mimes','add_custom_mime_types');
    function add_custom_mime_types($mimes){
        return array_merge($mimes,array (
            'ac3' => 'audio/ac3',
            'mpa' => 'audio/MPA',
            'flv' => 'video/x-flv',
                        'svg' => 'image/svg+xml'
        ));
    }
 This function will run when Wordpress looks to get the available mime types it will then merge the current mime types with the new mime types you want to add. ## Remove Existing Mime Types

 You can also do the opposite of adding custom mime types by removing the default mime types, for example if you don't want your users to upload video then you can remove the video mime type.   
add_filter('upload_mimes','remove_mime_types');
function remove_mime_types($mimes){
    unset( $mimes['mp4'] );
}

 This function does the opposite of the above, it will also run at the same time but instead of adding mime types to the existing mime types it will remove them from the returning array. ## List Of Mime Types To Use

 <table border="1" cellpadding="5px" cellspacing="0"><thead align="left"><tr><th>Extensions</th> <th>Media type</th> </tr></thead><tbody><tr><td>.au</td> <td>audio/basic</td> </tr><tr><td>.avi</td> <td>video/msvideo, video/avi, video/x-msvideo</td> </tr><tr><td>.bmp</td> <td>image/bmp</td> </tr><tr><td>.bz2</td> <td>application/x-bzip2</td> </tr><tr><td>.css</td> <td>text/css</td> </tr><tr><td>.dtd</td> <td>application/xml-dtd</td> </tr><tr><td>.doc</td> <td>application/msword</td> </tr><tr><td>.docx</td> <td>application/vnd.openxmlformats-officedocument.wordprocessingml.document</td> </tr><tr><td>.dotx</td> <td>application/vnd.openxmlformats-officedocument.wordprocessingml.template</td> </tr><tr><td>.es</td> <td>application/ecmascript</td> </tr><tr><td>.exe</td> <td>application/octet-stream</td> </tr><tr><td>.gif</td> <td>image/gif</td> </tr><tr><td>.gz</td> <td>application/x-gzip</td> </tr><tr><td>.hqx</td> <td>application/mac-binhex40</td> </tr><tr><td>.html</td> <td>text/html</td> </tr><tr><td>.jar</td> <td>application/java-archive</td> </tr><tr><td>.jpg</td> <td>image/jpeg</td> </tr><tr><td>.js</td> <td>application/x-javascript</td> </tr><tr><td>.midi</td> <td>audio/x-midi</td> </tr><tr><td>.mp3</td> <td>audio/mpeg</td> </tr><tr><td>.mpeg</td> <td>video/mpeg</td> </tr><tr><td>.ogg</td> <td>audio/vorbis, application/ogg</td> </tr><tr><td>.pdf</td> <td>application/pdf</td> </tr><tr><td>.pl</td> <td>application/x-perl</td> </tr><tr><td>.png</td> <td>image/png</td> </tr><tr><td>.potx</td> <td>application/vnd.openxmlformats-officedocument.presentationml.template</td> </tr><tr><td>.ppsx</td> <td>application/vnd.openxmlformats-officedocument.presentationml.slideshow</td> </tr><tr><td>.ppt</td> <td>application/vnd.ms-powerpointtd> </td> </tr><tr><td>.pptx</td> <td>application/vnd.openxmlformats-officedocument.presentationml.presentation</td> </tr><tr><td>.ps</td> <td>application/postscript</td> </tr><tr><td>.qt</td> <td>video/quicktime</td> </tr><tr><td>.ra</td> <td>audio/x-pn-realaudio, audio/vnd.rn-realaudio</td> </tr><tr><td>.ram</td> <td>audio/x-pn-realaudio, audio/vnd.rn-realaudio</td> </tr><tr><td>.rdf</td> <td>application/rdf, application/rdf+xml</td> </tr><tr><td>.rtf</td> <td>application/rtf</td> </tr><tr><td>.sgml</td> <td>text/sgml</td> </tr><tr><td>.sit</td> <td>application/x-stuffit</td> </tr><tr><td>.sldx</td> <td>application/vnd.openxmlformats-officedocument.presentationml.slide</td> </tr><tr><td>.svg</td> <td>image/svg+xml</td> </tr><tr><td>.swf</td> <td>application/x-shockwave-flash</td> </tr><tr><td>.tar.gz</td> <td>application/x-tar</td> </tr><tr><td>.tgz</td> <td>application/x-tar</td> </tr><tr><td>.tiff</td> <td>image/tiff</td> </tr><tr><td>.tsv</td> <td>text/tab-separated-values</td> </tr><tr><td>.txt</td> <td>text/plain</td> </tr><tr><td>.wav</td> <td>audio/wav, audio/x-wav</td> </tr><tr><td>.xlam</td> <td>application/vnd.ms-excel.addin.macroEnabled.12</td> </tr><tr><td>.xls</td> <td>application/vnd.ms-excel</td> </tr><tr><td>.xlsb</td> <td>application/vnd.ms-excel.sheet.binary.macroEnabled.12</td> </tr><tr><td>.xlsx</td> <td>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet </td> </tr><tr><td>.xltx</td> <td>application/vnd.openxmlformats-officedocument.spreadsheetml.template </td> </tr><tr><td>.xml</td> <td>application/xml</td> </tr><tr><td>.zip</td> <td>application/zip, application/x-compressed-zip</td></tr></tbody></table>

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email