Support » Fixing WordPress » XLSM Extension mis-recognized

  • Just noticed that you’veadded .xlsm as an allowed upload mime. But wp_check_filetype_and_ext() is not recognizing it correctly and kicking it out.

    Problem is in the comparison of $real_mime with the finfo_file() mime type returned by PHP. Tried in both PHP 5.6 and 7.2

    PHP: XLSM => application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
    WP: XLSM => application/

    With the mismatch it blanks the result giving a Security error for the upload.
    According to official Apache list at:

    WP has it right and PHP has it wrong, but the problem remains.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    You can adjust the mime types WordPress knows about with the mime_types filter. Put something like this in a plugin.

    add_filter( 'mime_types', 'example_adjust_mimes', 10, 1 );
    function example_adjust_mimes( $mimes ) {
      $mimes['xlsm'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
      return $mimes;
Viewing 1 replies (of 1 total)
  • The topic ‘XLSM Extension mis-recognized’ is closed to new replies.