Beispiel #1
0
 public function getMime()
 {
     if (is_null($this->mime)) {
         $this->mime = FS::getFileType($this->path);
     }
     return $this->mime;
 }
Beispiel #2
0
 /**
  * @return mixed
  */
 public function getType()
 {
     if (is_null($this->type)) {
         $this->type = FileSystem::getFileType($this->getPath());
     }
     return $this->type;
 }
Beispiel #3
0
 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;
 }