Skip to main content
deleted 5 characters in body
Source Link
Hashim Aziz
  • 297
  • 7
  • 18

According to the Codex, all that's needed to enable the unfiltered_ upload capability - i.e. the ability to upload any filetypes to the Media Library rather than just the default whitelisted ones - is to set:

define( 'ALLOW_UNFILTERED_UPLOADS', true );

...in wp-config, which I have done this and placed above the line where it says to stop editing.

Most online articles about enabling the capability suggest it's sufficient to stop here, including an answer on this very site, but the Codex itself suggests that it's necessary to actively assign the capability to users, which I've also done, in my theme's functions.php file:

$edit_admin = get_role('administrator');
$edit_admin->add_cap('unfiltered_upload');  

However, despite this, whenever going to my Media Library to upload a non-supported file (so far tested with an .AI file and .SVG file), I still get the standard error:

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

Why is this?

According to the Codex, all that's needed to enable the unfiltered_ upload capability - i.e. the ability to upload any filetypes to the Media Library rather than just the default whitelisted ones - is to set:

define( 'ALLOW_UNFILTERED_UPLOADS', true );

...in wp-config, which I have done this and placed above the line where it says to stop editing.

Most online articles about enabling the capability suggest it's sufficient to stop here, including an answer on this very site, but the Codex itself suggests that it's necessary to actively assign the capability to users, which I've also done, in my theme's functions.php file:

$edit_admin = get_role('administrator');
$edit_admin->add_cap('unfiltered_upload');  

However, despite this, whenever going to my Media Library to upload a non-supported file (so far tested with an .AI file and .SVG file), I still get the standard error:

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

Why is this?

According to the Codex, all that's needed to enable the unfiltered_ upload capability - i.e. the ability to upload any filetypes to the Media Library rather than just the default whitelisted ones - is to set:

define( 'ALLOW_UNFILTERED_UPLOADS', true );

...in wp-config, which I have done and placed above the line where it says to stop editing.

Most online articles about enabling the capability suggest it's sufficient to stop here, including an answer on this very site, but the Codex itself suggests that it's necessary to actively assign the capability to users, which I've also done, in my theme's functions.php file:

$edit_admin = get_role('administrator');
$edit_admin->add_cap('unfiltered_upload');  

However, despite this, whenever going to my Media Library to upload a non-supported file (so far tested with an .AI file and .SVG file), I still get the standard error:

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

Why is this?

Source Link
Hashim Aziz
  • 297
  • 7
  • 18

Why is unfiltered_upload not working despite being enabled?

According to the Codex, all that's needed to enable the unfiltered_ upload capability - i.e. the ability to upload any filetypes to the Media Library rather than just the default whitelisted ones - is to set:

define( 'ALLOW_UNFILTERED_UPLOADS', true );

...in wp-config, which I have done this and placed above the line where it says to stop editing.

Most online articles about enabling the capability suggest it's sufficient to stop here, including an answer on this very site, but the Codex itself suggests that it's necessary to actively assign the capability to users, which I've also done, in my theme's functions.php file:

$edit_admin = get_role('administrator');
$edit_admin->add_cap('unfiltered_upload');  

However, despite this, whenever going to my Media Library to upload a non-supported file (so far tested with an .AI file and .SVG file), I still get the standard error:

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

Why is this?