.epub file blocked despite ALLOW_UNFILTERED_UPLOADS set to true

I am still getting “X.epub: Sorry, this file type is not permitted for security reasons” despite adding:

define('ALLOW_UNFILTERED_UPLOADS', true);

to my wp-config.php.

Of course, I have allowed this type of file in my blog network’s configuration:

.epub file blocked despite ALLOW_UNFILTERED_UPLOADS set to true

Is this a normal situation (and using filters is the only workaround)?

Or this is something weird (like some plugin or theme overriding this) and you should keep looking for a possible cause?

EDIT (after comments and some more testing): This is .epub files-related only issue. I was able to verify that ALLOW_UNFILTERED_UPLOADS is working. The thing is that when it is enabled, it passes through all but .epub files. So, for the above screenshot, I was able to upload .azw3 and .mobi files. Out of all listed in “Upload file types” above only uploading of .epub files fails.

EDIT: This is my private blog network and I am logging via a super user account when using it.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You probably need to allow the mime types for them to be allowed to upload.

https://www.robertwent.com/blog/adding-custom-mime-types-for-wordpress-uploads/

//The following goes in a themes functions file or a custom hooks plugin

function so_387865_custom_upload_mimes ( $existing_mimes ) {
    $existing_mimes['epub'] = 'application/epub+zip';
    $existing_mimes['mobi'] = 'application/x-mobipocket-ebook';
 
    return $existing_mimes;
}
 
add_filter('upload_mimes', 'so_387865_custom_upload_mimes');


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x