On line 87 there is a call to mime_content_type which is a depreciated function, and therefore does not exist on many installs. When it is called on newer versions of PHP it will return a fatal error.
The solution is to check if the function exists before using the function:

if (function_exists('mime_content_type')) {
    $mime_type =  'Content-Type:'.mime_content_type($filepath);
  }
  else {
    $mime_type = NULL;
  }
	return array(
		$mime_type,
		'Content-Disposition: attachment; filename="' . basename($filepath) . '";',
		// Content-Length is also a good header to send, as it allows the browser to
		// display a progress bar correctly.
		// There's a trick for determining the file size for files over 2 GB. Nobody
		// should be using this module with files that large, but… the sprintf()
		// trickery makes sure the value is correct for files larger than 2GB. See
		// note at http://php.net/filesize
		'Content-Length: ' . sprintf('%u', filesize($filepath)),
	);

I tested the above code and it works.

Comments

arski’s picture

Title: mime_content_type() is depreciated... check for existence of function to prevent fatal error » replace deprecated mime_content_type()

Thanks,

Any ideas of an alternative solution though? Would still like to have the mime type sent back when forcing the download..

arski’s picture

Status: Active » Fixed

OK, fixed using an alternative from http://www.php.net/manual/en/function.finfo-file.php in PHP 5.3, and mime_content_type if that doesn't exist.. should cover all cases.. if not then you're out of luck ;)

Thanks for reporting.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.