0

I have an issue for uploading .ppsx format on the media library. all the powerpoint format (pptx ppt, pps) can be uploading without problem except the .ppsx format and i don't know why.

when i try to upload this format i have this message : Sorry, this file type is not permitted for security reasons.

Even though WordPress by default(wp_get_mime_types()) allow .ppsx, I try the following methods, but method 1 and 2 does not work and method 3 is not secure and does not work for no admin users.

First Method:

Add the file type through my theme functions.php (Microsoft MIME Type Confirmed Here):

function allow_file_types($mime_types){
    $mime_types['ppsx'] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow';
    return $mime_types;
}
add_filter('upload_mimes', 'allow_file_types', 1, 1);

Second Method: Install plugins, which is does the exact same thing as my functions.php method.

WP Extra File Types WP Add Mime Types

Third Method: Add this line of code on the wp-config.php

define(‘ALLOW_UNFILTERED_UPLOADS’, true)

this method is not secure for me and only admin can upload the .ppsx files)

method that partially works (method 4)

The only method that partially works is to add the below code :

function my_check_filetype_and_ext( $info, $file, $filename, $mimes, $real_mime )
{
    if ( empty( $check['ext'] ) && empty( $check['type'] ) )
    {
        $secondaryMimetypes = ['ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation'];

        // Run another check, but only for our secondary mime and not on core mime types.
        remove_filter( 'wp_check_filetype_and_ext', 'my_check_filetype_and_ext', 99, 5 );
        $info = wp_check_filetype_and_ext( $file, $filename, $secondaryMimetypes );
        add_filter( 'wp_check_filetype_and_ext', 'my_check_filetype_and_ext', 99, 5 );
    }

    return $info;
}
add_filter( 'wp_check_filetype_and_ext', 'my_check_filetype_and_ext', 99, 5 );

The problem is if we add this code on functions.php we will be able to upload .ppsx files but all others format can't be uploaded in media library.

Thanks in advance for your help

8
  • which version of WordPress are you using? WP already has ppsx support built in, it was already in WP at least 8 years ago. Your issue is more likely to be that PPSX support is being removed by broken/faulty code, not that it needs adding. Disable all plugins, switch to the default theme, and try again, then re-activate plugins until PPSX uploads stop working
    – Tom J Nowell
    Nov 16, 2020 at 16:55
  • 1
    github.com/WordPress/WordPress/blob/… for reference
    – Tom J Nowell
    Nov 16, 2020 at 16:56
  • PPSX support was introduced 10 years ago by Otto in github.com/WordPress/WordPress/commit/…, which was WordPress v3.1, here's the ticket that added PPSX support core.trac.wordpress.org/ticket/17117 which discusses Office 2007 support
    – Tom J Nowell
    Nov 16, 2020 at 17:00
  • Could it be that ppsx was deleted from the list of allowed formats in the network admin media settings?
    – Tom J Nowell
    Nov 16, 2020 at 17:04
  • Thanks for the reply Tom. I'm using wordpress 5.5.3 (last version). I don't delete .ppsx from the list of allowed formats. have this problem of uploading in 2 servers. for tests purpose i added a fresh WordPress installation without any additionnel plugins and still have the same issue.
    – Samuel
    Nov 16, 2020 at 17:37

1 Answer 1

0

In addition to the bug being reported, you might have some mileage trying the following in your wp-config.php file:

define( 'ALLOW_UNFILTERED_UPLOADS', true );

If you’d prefer not to edit your wp-config.php file and/or you want more control over exactly which file types can be uploaded to your site, you can use the free WP Extra File Types plugin at WordPress.org

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.