setValue($filename); // Is file readable ? if (empty($file) || false === stream_resolve_include_path($file)) { $this->error(self::NOT_READABLE); return false; } $mimefile = $this->getMagicFile(); if (class_exists('finfo', false)) { if (!$this->isMagicFileDisabled() && (!empty($mimefile) && empty($this->finfo))) { $this->finfo = finfo_open(FILEINFO_MIME_TYPE, $mimefile); } if (empty($this->finfo)) { $this->finfo = finfo_open(FILEINFO_MIME_TYPE); } $this->type = null; if (!empty($this->finfo)) { $this->type = finfo_file($this->finfo, $file); } } if (empty($this->type) && $this->getHeaderCheck()) { $this->type = $filetype; } if (empty($this->type)) { $this->error(self::NOT_DETECTED); return false; } $mimetype = $this->getMimeType(true); if (in_array($this->type, $mimetype)) { $this->error(self::FALSE_TYPE); return false; } $types = explode('/', $this->type); $types = array_merge($types, explode('-', $this->type)); $types = array_merge($types, explode(';', $this->type)); foreach ($mimetype as $mime) { if (in_array($mime, $types)) { $this->error(self::FALSE_TYPE); return false; } } return true; } }