Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call to undefined function mime_content_type()

Using Suite crm 7.9.1 . newbie to suitecrm.

I created a Person Form in Campaigns module . Created successfully . But when i tried to download it , got the below error .

Fatal error: Uncaught Error: Call to undefined function mime_content_type() in /home/testsite/public_html/download.php:180 Stack trace: #0 /home/testsite/public_html/include/MVC/Controller/SugarController.php(1007): require_once() #1 /home/testsite/public_html/include/MVC/Controller/SugarController.php(458): SugarController->handleEntryPoint() #2 /home/testsite/public_html/include/MVC/Controller/SugarController.php(366): SugarController->process() #3 /home/testsite/public_html/include/MVC/SugarApplication.php(108): SugarController->execute() #4 /home/testsite/public_html/index.php(53): SugarApplication->execute() #5 {main} thrown in /home/testsite/public_html/download.php on line 180

when i browsed on this error got a solution that to install this extension . I am using PHP 7 .

Adding the extensions to cpanel in live , is it safe .. As it is shared host , does it affects other php projects .

When i executed phpinfo found something about mime_type . below

default_mimetype - text/html
mbstring.http_output_conv_mimetypes - ^(text/|application/xhtml\+xml)
like image 781
bhavya Avatar asked Dec 05 '22 13:12

bhavya


2 Answers

You need to install fileinfo extension in order to use mime_content_type. In debian based system you can install it via apt: apt-get install php-mime-type

More info: http://php.net/manual/en/book.fileinfo.php

like image 172
Karol Samborski Avatar answered Dec 21 '22 23:12

Karol Samborski


I was trying to get the mimeType of a file using mime_content_type() but it was not working.

Here this works for me:

$file = $request->file('FILE_NAME_IN_REQUEST');
$mimeType = $file->getClientmimeType();
like image 35
Imran_Developer Avatar answered Dec 21 '22 23:12

Imran_Developer