1

I've already read about mime types in wordress and how to add them, but I can't find any documentation about the correct type of files. For e.g. after a lot of research I find out that the epub extension has a application/epub+zip file type, but how to get other unknown files like .blend or .xcf to work?

The following pseudocode illustrates the problem:

function custom_mime_types($mime_types){

    //Adding unknown extension 
    $mime_types['unknownextension'] = 'typeoffile'; 
    return $mime_types;
}

add_filter('upload_mimes', 'custom_mime_types', 1, 1);

Is there a Documentation about it?

2

You can use this function as you mentioned and you need to learn your file extensions mime type (in example i add svg and xcf upload ability to wordpress)

add_filter('upload_mimes', 'ability_to_upload');

function ability_to_upload($mimes = array()) {
    $mimes['svg'] = 'image/svg+xml';
    $mimes['xcf'] = 'image/xcf';
    return $mimes;
}

Here is a link for mime types list and file extension checker (you can search by file extension)

| improve this answer | |
  • Thanks Serkan, mime types list is helpfull! Sorry cant upvote you. But what about the blend-file? – p2or Oct 14 '14 at 13:27
  • You are welcome :) No problem with upvote, but you can select answer is right i think. i couldn't find blend file mime type either. – Serkan Algur Oct 14 '14 at 18:04
  • Comment after 3 years :D .blend mime-type is application/x-blender :) – Serkan Algur Nov 28 '17 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.