Allow more file types for upload

Allow more file types for upload

If you ever tried to upload some not so common filetypes, such as .ai to your WordPress blog, you may have experienced an error, because WordPress simply doesn’t want you to upload some other file type.
Fortunately, you can add new file types to WordPress whitelist. Paste the followingcode in your functions.php, and you’re done.

function addUploadMimes($mimes) {
    $mimes = array_merge($mimes, array(
        'ai|eps|psd|tmbundle|tmCommand|tmDragCommand|tmSnippet|tmLanguage|tmPreferences' => 'application/octet-stream'

    return $mimes;

add_filter('upload_mimes', 'addUploadMimes');

Note that file types have to be separated by a pipe.


Geef een antwoord

Het e-mailadres wordt niet gepubliceerd.