示例#1
0
 /**
  * Analyzes a file path and creates the filder structure necessary to sucessfully store it
  *
  * @param string $path Path to analyze
  *
  * @return bool Whether the folder was sucessfully created
  */
 static function createUploadFolder(string $path) : bool
 {
     $DS = RegExp::escapeBackslashes('\\/');
     $folder = preg_replace(new RegExp("^(.*[{$DS}])[^{$DS}]+\$"), '$1', preg_replace(new RegExp('$DS'), '\\', $path));
     return !is_dir($folder) ? mkdir($folder, 0777, true) : true;
 }
示例#2
0
 function testEscapeBackslashes()
 {
     $result = RegExp::escapeBackslashes('\\');
     self::assertEquals('\\\\', $result);
 }