Add wrapper around move_uploaded_file

This commit is contained in:
2021-07-20 01:26:31 +02:00
parent dbbdf4f230
commit 6adf0ee0a2
2 changed files with 40 additions and 0 deletions

View File

@ -679,4 +679,23 @@ final class MD_STD {
return $code;
}
/**
* Checks if a directory is writable.
*
* @param string $dir Directory path.
*
* @return void
*/
public static function check_is_writable(string $dir):void {
if (is_dir($dir) === false) {
throw new MDFileDoesNotExist("Directory " . $dir . " does not exist");
}
if (is_writable($dir) === false) {
throw new MDFileIsNotWritable("Directory " . $dir . " is not writable");
}
}
}