generateUID() public method

generate the UID for the file from the file name.
public generateUID ( )
Ejemplo 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;
 }