CMS MADE SIMPLE FORGE

plFileHandler

 

[#7446] Call to undefined function mime_content_type()

avatar
Created By: Bernd Klenk (klenkes)
Date Submitted: Wed Jan 11 14:47:52 -0500 2012

Assigned To: Pierre-Luc Germain (plger)
Version: plFileHandler 0.6
CMSMS Version: 1.10.2
Severity: Major
Resolution: None
State: Open
Summary:
Call to undefined function mime_content_type()
Detailed Description:
I recently tried to select a file through the select interface which was mp3 and
flv and received an error message.:
Fatal error: Call to undefined function mime_content_type() in
/path.../modules/plFileHandler/function.GetFileInfo.php on line 53

Line 53:
$info["mime"] = mime_content_type($filepath);
According to the PHP manual:
"The function requires the (deprecated) Mime Magic extension to be activated."

I couldn't find one host among my clients who support this.

So I changed it to:
$info["mime"] = pathinfo($filepath);

Works... but then again, I am no PHP expert.


History

Comments
avatar
Date: 2012-06-06 03:14
Posted By: Coen van M (coenos86)

I've the same problem, but the solution above gives some problems while loading
the filelist.
Should the function mime_content_type() be replaced by finfo_file() ?
      
avatar
Date: 2012-06-06 05:05
Posted By: Pierre-Luc Germain (plger)

Without option, pathinfo returns an array. Hence the modification should be:
  $info["mime"] = pathinfo($filepath);
  $info["mime"] = $info["mime"]["extension"];
But this is the same as using the $extension ...

Alternatively, coenos86's suggestion should work:
  $finfo = finfo_open(FILEINFO_MIME_TYPE);
  $info["mime"] = finfo_file($finfo,$filepath);
  finfo_close($finfo);