public function getMimeType()
{
if ($this->_mime_type) {
return $this->_mime_type;
}
if ($this->getIsFile()) {
if ($this->getReadable()) {
if ($this->_is_uploaded) {
return $this->_mime_type = $this->_uploaded_inst->getType();
}
if (function_exists('finfo_open')) {
if (($info = @finfo_open(FILEINFO_MIME)) && ($result = finfo_file($info, $this->_realpath)) !== False) {
return $this->_mime_type = $result;
}
}
if (function_exists('mime_content_type') && ($result = @mime_content_type($this->_realpath)) !== False) {
return $this->_mime_type = $result;
}
return $this->_mime_type = $this->getMimeTypeByExtension($this->_realpath);
}
$this->addLog('Unable to get mime type for file');
return False;
} else {
$this->addLog('getMimeType() method is available only for files', 'warning');
return False;
}
}