When I try to upload a *.prc
file type, I get this error:
Sorry, this file type is not permitted for security reasons.
How can I fix this?
This article explains a method in which you can add a file type to the list of allowed file types.
Copy and paste the following code into your functions.php
:
add_filter('upload_mimes', 'custom_upload_mimes');
function custom_upload_mimes ( $existing_mimes=array() ) {
// add your extension to the array
$existing_mimes['prc'] = 'application/x-mobipocket-ebook';
// add as many as you like
// and return the new full result
return $existing_mimes;
}
I didn't tested the code, but I hope it will help you along.
Add following code in your themes functions.php
file.
I have tested the code and its working fine.
// Add the filter
add_filter('upload_mimes', 'custom_upload_mimes');
function custom_upload_mimes ( $existing_mimes=array() ) {
// Add file extension 'extension' with mime type 'mime/type'
$existing_mimes['prc'] = 'application/x-mobipocket';
// and return the new full result
return $existing_mimes;
}
For more information see this codex page.