public function getMime() { if (is_null($this->mime)) { $this->mime = FS::getFileType($this->path); } return $this->mime; }
/** * @return mixed */ public function getType() { if (is_null($this->type)) { $this->type = FileSystem::getFileType($this->getPath()); } return $this->type; }
public function getSavePath($ext = null, $currentPath = null) { $configPaths = []; if ($ext) { $configPaths[] = ["Attach", "filesPath", $ext]; } if ($currentPath) { $fileMime = FileSystem::getFileType($currentPath); $configPaths[] = ["Attach", "filesPath", $fileMime]; $fileType = FileSystem::getFileTypeConst($currentPath); $configPaths[] = ["Attach", "filesPath", $fileType]; } $configPaths[] = ["Attach", "filesPath", "default"]; $configPaths[] = ["Attach", "filesPath"]; $path = $this->getConfig()->getOneIs($configPaths); if (is_array($path)) { throw new \RuntimeException("Many option for file path available"); } return $path; }