Beispiel #1
0
 /**
  * @return mixed|string
  */
 public function getFileName()
 {
     if (!$this->fileName) {
         $this->fileName = pathinfo($this->filePath, PATHINFO_BASENAME);
         $this->fileName = FileUtil::filterFileName($this->fileName);
     }
     return $this->fileName;
 }
Beispiel #2
0
 /**
  * @param $field
  */
 public function __construct($field)
 {
     if (empty($_FILES[$field])) {
         throw new InvalidArgumentException('file not uploaded as ' . $field . ' check if your form is uploading file with name attribute as ' . $field);
     }
     $fileInfo = $_FILES[$field];
     $this->fileName = FileUtil::filterFileName(pathinfo($fileInfo['name'], PATHINFO_BASENAME));
     $this->filePath = $fileInfo['tmp_name'];
     $this->fileSize = intval($fileInfo['size']);
     $this->mimeType = $fileInfo['type'];
 }