
WooCommerce is well suited to selling digital products, but there is a common stumbling block for anyone selling eBooks: WordPress does not allow EPUB or MOBI file uploads by default. These formats are not on the platform's list of approved MIME types, so attempting to upload them produces an error.
The fix is straightforward and takes less than ten minutes. You create a small custom plugin that adds EPUB and MOBI to the allowed file types, then activate it through the WordPress admin.
Why this happens
WordPress restricts uploads to a predefined list of MIME types as a security measure. PDF, ZIP, MP3, and most image formats are on the list by default. EPUB (the standard format for most e-readers) and MOBI (the format used by Kindle devices) are not.
Rather than modifying WordPress core files, which would be overwritten on every update, the cleanest approach is a simple one-purpose plugin.
What you will need
- FTP access or a file manager in your hosting control panel
- Access to the WordPress admin (to activate the plugin)
- Your EPUB or MOBI eBook file ready to upload
Step-by-step instructions
Step 1: Create the plugin folder
Using your FTP client or hosting file manager, navigate to wp-content/plugins/ and create a new folder named ebooks-upload-support.
Step 2: Create the plugin file
Inside that folder, create a new file named ebooks-upload-support.php.
Step 3: Add the plugin code
Open the file and paste in the following code:
<?php
/**
* Plugin Name: eBooks Upload Support
* Description: Adds EPUB and MOBI MIME type support for WooCommerce downloadable products.
* Version: 1.0
* Author: AR Digital Solutions
*/
// Add EPUB and MOBI to allowed upload types
function ardigital_allow_ebook_uploads( $mimes ) {
$mimes['epub'] = 'application/epub+zip';
$mimes['mobi'] = 'application/x-mobipocket-ebook';
return $mimes;
}
add_filter( 'upload_mimes', 'ardigital_allow_ebook_uploads' );
// Increase upload size limit to 100MB
@ini_set( 'upload_max_size' , '100M' );
@ini_set( 'post_max_size', '100M' );
@ini_set( 'max_execution_time', '300' );
Save the file.
Step 4: Activate the plugin
Log in to your WordPress admin, go to Plugins, find eBooks Upload Support in the list, and click Activate.
Step 5: Upload your eBook as a downloadable product
In WooCommerce, go to Products > Add New. Under the Product data section, tick Downloadable. Click Add File, then upload your EPUB or MOBI file. It will now be accepted without an error.
Complete the product details and publish.
Testing the upload
After activating the plugin, do a test upload of a small EPUB or MOBI file before uploading your full product file. Confirm the upload succeeds, then proceed with your actual eBook.
A note on file size
Most eBooks are small, typically under 10MB, so the 100MB limit in the plugin code is generous for standard use. If you are distributing illustrated or multimedia-enhanced eBooks that are larger, your hosting provider can adjust the PHP memory and upload limits at the server level.