2021年4月6日星期二

"Sorry, this file type is not permitted for security reasons." when trying to upload a file to Wordpress media library

I'm trying to figure out why I can't upload a .ppt file to the Wordpress media library. It gives me an error saying "Sorry, this file type is not permitted for security reasons.". I've heard that was an error given when the mime type isn't allowed. PPT files are listed as default allowed files so why is this happening? I've gone through trying to debug it but can't figure out what else it might be. I don't want to go the route to set WP to allow anything to be uploaded since it sounds like a security risk. Anyone else have any other ideas?

  1. The file sizes are in the KB range so that shouldn't be the problem.
  2. I was able to upload a .ppt that's a couple of years old but I have a new file I created recently but can't upload it. I checked both mime types and they are both application/vnd.ms-powerpoint.
  3. I checked if maybe it was a WP version problem and went back to my previous WP version 5.3 (current is 5.7) but it's still the same problem.
  4. Tried using a File Upload Types plugin to add the application/vnd.ms-powerpoint mime. Didn't fix the problem.
  5. Tried adding the mime type in my functions.php with the add_filter which worked for other mime types but didn't fix this either.
function allowable_myme_types($mime_types){     $mime_types['ppt'] = 'application/vnd.ms-powerpoint';  }  add_filter('upload_mimes', 'allowable_myme_types', 1, 1);  
https://stackoverflow.com/questions/66978751/sorry-this-file-type-is-not-permitted-for-security-reasons-when-trying-to-up April 07, 2021 at 10:24AM

没有评论:

发表评论