fonction d'upload fully working now !

This commit is contained in:
2019-03-07 10:52:56 +01:00
parent a2f1200654
commit 194ca52738
3 changed files with 35 additions and 4 deletions

View File

@ -73,4 +73,22 @@ class Functions {
$parent->appendChild($importedNode);
}
}
public static function deleteDir($dirPath) {
if (! is_dir($dirPath)) {
throw new InvalidArgumentException("$dirPath must be a directory");
}
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/';
}
$files = glob($dirPath . '*', GLOB_MARK);
foreach ($files as $file) {
if (is_dir($file)) {
self::deleteDir($file);
} else {
unlink($file);
}
}
rmdir($dirPath);
}
}