Example #1
0
 /**
  * Validate the supplied filename, extension and path.
  * @param string $fileName
  */
 protected function validateFileName($fileName = null)
 {
     if ($fileName === null) {
         $fileName = $this->model->fileName;
     }
     if (!strlen($fileName)) {
         throw (new MissingFileNameException())->setModel($this->model);
     }
     if (!$this->validateFileNamePath($fileName, $this->model->getMaxNesting())) {
         throw (new InvalidFileNameException())->setInvalidFileName($fileName);
     }
     $this->validateFileNameExtension($fileName, $this->model->getAllowedExtensions());
     return true;
 }