ProtectedFile::getFilePath PHP Method

getFilePath() public method

Path to file without filename.
public getFilePath ( ) : string
return string
    public function getFilePath()
    {
        return self::getBasePath() . '/' . substr($this->uid, 0, 1) . '/' . substr($this->uid, 1, 1) . '/' . substr($this->uid, 2, 1);
    }

Usage Example

Esempio n. 1
0
 /**
  * create a new protected file object which has properties that can be used for writing an actual file to
  *
  * @param string $name
  * @return ProtectedFile
  */
 public static function createForWriting($name)
 {
     $file = new ProtectedFile();
     $file->name = $name;
     $file->generateUID();
     $path = $file->getFilePath();
     if (!file_exists($path)) {
         if (!@mkdir($path, 0755, true)) {
             throw new Exception("{$path} could not be created: permission denied");
         }
     }
     return $file;
 }