Symfony\Component\HttpFoundation\File\File::getMimeType PHP Метод

getMimeType() публичный Метод

The mime type is guessed using the functions finfo(), mime_content_type() and the system binary "file" (in this order), depending on which of those is available on the current operating system.
public getMimeType ( ) : string | null
Результат string | null The guessed mime type (i.e. "application/pdf")
    public function getMimeType()
    {
        $guesser = MimeTypeGuesser::getInstance();

        return $guesser->guess($this->getPathname());
    }

Usage Example

Пример #1
0
 /**
  * Get mime type of file.
  *
  * @return string
  */
 public function getMimeType()
 {
     if ($this->file instanceof UploadedFile) {
         return $this->file->getClientMimeType();
     }
     return $this->file->getMimeType();
 }
All Usage Examples Of Symfony\Component\HttpFoundation\File\File::getMimeType