Description
This function creates an Apache MIME type handler for a file extension.
Examples
cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Mime/add_handler?extension=.foo&handler=text-foo
LiveAPI PHP Class
$cpanel = new CPANEL();
$mime_add_handler = $cpanel->uapi(
'Mime', 'add_handler',
array(
'extension' => '.foo',
'handler' => 'text-foo',
)
);
LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new();
my $mime_add_handler = $cpliveapi->uapi(
'Mime', 'add_handler',
{
'extension' => '.foo',
'handler' => 'text-foo',
}
);
cPanel Template Toolkit
[% data = execute( 'Mime', 'add_handler', {'extension'=> '.foo', 'handler' => 'text-foo' } ); %]
Command Line
uapi --user=username Mime add_handler extension=.foo handler=text-foo
|
Output (JSON)
{
"messages": null,
"errors": null,
"status": 1,
"data": null
}
Parameters
|
Parameter
|
Type
|
Description
|
Possible values
|
Example
|
|
extension
|
string
|
Required
The file extension.
|
A valid file extension.
|
.foo
|
|
handler
|
string
|
Required
The Apache MIME handler.
|
A valid Apache MIME handler.
|
txt-foo
|
Returns
This function only returns metadata.