19declare(strict_types=1);
36 string $ilias_data_dir
52 $base_name = basename(
55 if ($base_name ===
'' || $base_name ===
'.' || $base_name ===
'..') {
56 throw new \InvalidArgumentException(
57 'Invalid temporary upload file name.'
66 string $ilias_data_dir
68 $data_dir = rtrim($ilias_data_dir,
'/\\');
69 $temp_dir =
"{$data_dir}/temp";
70 $real_temp = $this->getRealPath($temp_dir);
71 if ($real_temp ===
false) {
72 throw new \InvalidArgumentException(
73 'Temporary directory is not accessible.'
77 $real_source = $this->getRealPath(
"{$temp_dir}/{$base_name}");
78 if ($real_source ===
false || !is_file($real_source)) {
79 throw new \InvalidArgumentException(
80 'Temporary upload file not found.'
84 if (!str_starts_with($real_source,
"{$real_temp}/")) {
85 throw new \InvalidArgumentException(
86 'Temporary upload file is outside the temp directory.'
Resolves a user-supplied temp file identifier to an absolute path that is guaranteed to refer to a re...
buildAndCheckBaseName(string $temp_file_name)
buildAndCheckSource(string $base_name, string $ilias_data_dir)
getRealPath(string $path)
__construct(string $temp_file_name, string $ilias_data_dir)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...