Description
This function adds an Apache MIME type handler for a specific file extension.
Examples
LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$add_handler = $cpanel->api1('Mime', 'add_handler', array('.txt','text/plain') ); // Call the function.
LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $add_handler = $cpliveapi->api1('Mime', 'add_handler', ['.txt','text/plain'] ); # Call the function.
cPanel Tag System (deprecated)
Warning:
In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. This example is present in order to help developers move from the old cPanel tag system to our LiveAPI.
We strongly recommend that you only use the LiveAPI system to call the cPanel APIs.
<cpanel Module="Mime::add_handler( $FORM('ext','handler') )">
Command Line
cpapi1 --user=username Mime addhandler ext=.txt handler=text/plain
Output (none)
This function does not return output.
Parameters
Parameter
|
Type
|
Description
|
Possible Values
|
Example
|
exts
|
string
|
Required
The file extension for which to add a MIME handler.
|
Any valid file extension.
|
.txt
|
handler
|
string
|
Required
The handler to add.
|
A valid MIME handler type.
|
text/plain
|
Returns
This function does not return output.