Comments on: How to FIX “Sorry this file type is not permitted for security reasons.” https://diviengine.com/how-to-fix-sorry-this-file-type-is-not-permitted-for-security-reasons/ Boost the power of your Divi website Fri, 17 Nov 2023 12:31:34 +0000 hourly 1 https://wordpress.org/?v=6.5.4 By: hoy https://diviengine.com/how-to-fix-sorry-this-file-type-is-not-permitted-for-security-reasons/#comment-218072 Sat, 17 Dec 2022 12:27:57 +0000 https://diviengine.com/?p=72590#comment-218072 In reply to Divi Engine.

Just wondering why you guys never follow up on your blogposts ad or video tutorials.
When you don’t want to just turn of the option to reply.

This is becoming an embarrassment and not just on your own site but also on Youtube and the Facebook groups!

]]>
By: Terry https://diviengine.com/how-to-fix-sorry-this-file-type-is-not-permitted-for-security-reasons/#comment-205400 Mon, 29 Aug 2022 04:12:47 +0000 https://diviengine.com/?p=72590#comment-205400 In reply to Divi Engine.

Hi I tried the above function and now it won’t let me upload png or jpg files. I tried to add those in the function but it doesn’t work. Is there a way to get them allow uploads? I can successfully upload svg using a different function and it allows png and jpg uploads but not font files.
Thanks

]]>
By: Divi Engine https://diviengine.com/how-to-fix-sorry-this-file-type-is-not-permitted-for-security-reasons/#comment-171925 Wed, 23 Jun 2021 10:49:19 +0000 https://diviengine.com/?p=72590#comment-171925 In reply to Connie.

Hello Connie!

Robey from the Divi Engine team here.

WordPress is notoriously fussy when it comes to fonts, especially TTF files.

Sometimes for cases like this, you need to add an additional filter to the functions.php file below the code block where we enable the mime types.

Please go ahead and add the code below to your functions.php and let me know if it works 🙂


function divi_engine_font_correct_filetypes( $data, $file, $filename, $mimes, $real_mime ) {

if ( ! empty( $data['ext'] ) && ! empty( $data['type'] ) ) {
return $data;
}

$wp_file_type = wp_check_filetype( $filename, $mimes );

// Check for the file type you want to enable, e.g. 'svg'.
if ( 'ttf' === $wp_file_type['ext'] ) {
$data['ext'] = 'ttf';
$data['type'] = 'font/ttf';
}

if ( 'otf' === $wp_file_type['ext'] ) {
$data['ext'] = 'otf';
$data['type'] = 'font/otf';
}

return $data;
}
add_filter( 'wp_check_filetype_and_ext', 'divi_engine_font_correct_filetypes', 10, 5 );

]]>
By: Connie https://diviengine.com/how-to-fix-sorry-this-file-type-is-not-permitted-for-security-reasons/#comment-171923 Wed, 23 Jun 2021 09:49:28 +0000 https://diviengine.com/?p=72590#comment-171923 I followed your suggestion and edited the function.php of my installation
I tried to use the fonts in a module by uploading the files .otf and .ttf in the design-tab of the text.module
still get the “permission problem”, can’t upload the file

I used the mime types ‘font/otf’ and ‘font/ttf’

no chance

]]>