1

I tried to upload a .mp3 file and wordpress rejected and display message:

Sorry, this file type is not permitted for security reasons.

This happened with some .mp3 file only. I'm using wordpress 4.9.6

1 Answer 1

2

you need to allow them to be uploaded in your media files.

you can add following code to your themes functions.php

function my_mime_types($mime_types){
    $mime_types['mp3'] = 'audio/mpeg';
    return $mime_types;
}
add_filter('upload_mimes', 'my_mime_types', 1, 1);

there is more information about adding new mime types in WP here: https://wpsmackdown.com/add-remove-filetypes-wordpress-media-library/#add-filetypes

And here a list of the mime_types: https://feedforall.com/mime-types.htm

2
  • When I checked the code, I found out that the mine_type of the file is >application/octet-stream Is it wordpress bug?
    – minhbh
    Oct 24, 2018 at 10:33
  • you are right. you can use application/octet-stream. it's a official one or also audio/mpeg should work. updated my post... Oct 24, 2018 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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