コード例 #1
0
ファイル: File.php プロジェクト: deltaphp/deltautils
 public function getMime()
 {
     if (is_null($this->mime)) {
         $this->mime = FS::getFileType($this->path);
     }
     return $this->mime;
 }
コード例 #2
0
ファイル: UploadFile.php プロジェクト: deltaphp/httpwarp
 /**
  * @return mixed
  */
 public function getType()
 {
     if (is_null($this->type)) {
         $this->type = FileSystem::getFileType($this->getPath());
     }
     return $this->type;
 }
コード例 #3
0
ファイル: FileManager.php プロジェクト: deltaphp/attach
 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;
 }