0

Has anyone found a good way to upload AVIF images files through the WordPress media uploader?

I've seen variations of this code posted everywhere:

function allowed_mime_types( $mime_types ) {

  //AVIF Images
  $mime_types['avif'] = 'image/avif';

  return $mime_types;
}

add_filter( 'upload_mimes', 'allowed_mime_types' );

But, when I use that I still get an error:

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

I confirmed that avif is added to the list of extensions in the plupload localized script vars, but still no joy. What am I missing?

3
  • Try with adding this plugin for expand security reasons wordpress.org/plugins/blob-mimes
    – Gregory
    Dec 1, 2020 at 0:58
  • Thanks for the suggestion. Can you confirm if that plugin allows AVIF uploads? What technique does it use? I took a quick look at the source, but it's a pretty heavy plugin, and I wasn't able to quickly see how it works.
    – Dominic P
    Dec 1, 2020 at 19:17
  • honestly i've didn't try it, but after looking around, it seems to be the solution.
    – Gregory
    Dec 3, 2020 at 8:29

0

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.

Browse other questions tagged or ask your own question.