/** * Check if specified mime type is accepted. * * @param string $mimeType * * @return bool */ public function isMimeTypeAccepted($mimeType) { $accepted = self::$acceptedMimeTypes->all(); if (empty($accepted)) { return true; } return self::$acceptedMimeTypes->isAccepted($mimeType); }
/** * Check file was uploaded successfully. * * @return bool */ public function isValid() { if (false === ($this->mimeTypeValid = $this->acceptedMimeTypes->isAccepted($this->getMimeType()))) { return false; } $isOk = UPLOAD_ERR_OK === $this->error; return $this->test ? $isOk : $isOk && is_uploaded_file($this->getPathname()); }