Esempio n. 1
0
 public function setFile(UploadedFile $file)
 {
     if (!$file->isValid()) {
         throw new UploadException();
     }
     $this->file = $file;
 }
Esempio n. 2
0
 /**
  * Check if uploaded file is uploadable and an image.
  *
  * @return bool
  */
 private function isUploadableImage()
 {
     return $this->file->isValid() && in_array($this->file->getMimeType(), ['image/gif', 'image/jpeg', 'image/png']);
 }