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();
 }
 /**
  * Constructor.
  *
  * @param File $file A File instance
  */
 public function __construct(File $file)
 {
     if ($file instanceof UploadedFile) {
         parent::__construct($file->getPathname(), $file->getClientOriginalName(), $file->getClientMimeType(), $file->getClientSize(), $file->getError(), true);
     } else {
         parent::__construct($file->getPathname(), $file->getBasename(), $file->getMimeType(), $file->getSize(), 0, true);
     }
 }
 protected function getMimeType(File $file)
 {
     return $file instanceof UploadedFile ? $file->getClientMimeType() : $file->getMimeType();
 }