CRM_Core_Error::statusBounce('Could not retrieve the file');
}
+ $testMimeType = CRM_Utils_File::getMimeType($path);
+ if ($testMimeType != $mimeType) {
+ throw new CRM_Core_Exception("Supplied Mime Type does not match file Mime Type");
+ }
+
$buffer = file_get_contents($path);
if (!$buffer) {
CRM_Core_Error::statusBounce('The file is either empty or you do not have permission to retrieve the file');
return FALSE;
}
+ /**
+ * Get the Mime-Type of a file based on the url path
+ * @param string $path full filename path
+ * @return string|bool
+ */
+ public function getMimeType($path = NULL) {
+ return mime_content_type($path);
+ }
+
}