尝试将子域 A 中的上传文件移动到子域 B
Trying to move an uploaded file in sub domain A to sub domain B
我只能上传子域 A 中的图片,但无论我做什么,我都不能上传到 B。这就是我所拥有的:
$move_to = $_SERVER['DOCUMENT_ROOT'] . "/assets/pinturas/$timestamp-" . $file;
$move_to_site = $this->config->item('testing_domain_root') . "/assets/pinturas/$timestamp-" . $file;
$outputThis = move_uploaded_file($_FILES['nuevaPintura']['tmp_name'], $move_to);
$outputOther = move_uploaded_file($_FILES['nuevaPintura']['tmp_name'], $move_to_site);
变量:$this->config->item('testing_domain_root')
等同于$_SERVER['DOCUMENT_ROOT']
(我这样做是为了使它与不同的子域相同)。
但是,在检查 move_uploaded_file
方法的值时,本地方法(子域 A)给出 TRUE,而子域 B returns 什么都没有。
两个子域都存在于同一台服务器中,所以我不知道为什么会发生这种情况。
move_uploaded_file() 函数将源文件移动到另一个位置。您只是不能将同一个文件移动两次。
作为替代解决方案,您可以将移动的文件复制到第二个位置。
$outputOther = copy($move_to, $move_to_site);
我只能上传子域 A 中的图片,但无论我做什么,我都不能上传到 B。这就是我所拥有的:
$move_to = $_SERVER['DOCUMENT_ROOT'] . "/assets/pinturas/$timestamp-" . $file;
$move_to_site = $this->config->item('testing_domain_root') . "/assets/pinturas/$timestamp-" . $file;
$outputThis = move_uploaded_file($_FILES['nuevaPintura']['tmp_name'], $move_to);
$outputOther = move_uploaded_file($_FILES['nuevaPintura']['tmp_name'], $move_to_site);
变量:$this->config->item('testing_domain_root')
等同于$_SERVER['DOCUMENT_ROOT']
(我这样做是为了使它与不同的子域相同)。
但是,在检查 move_uploaded_file
方法的值时,本地方法(子域 A)给出 TRUE,而子域 B returns 什么都没有。
两个子域都存在于同一台服务器中,所以我不知道为什么会发生这种情况。
move_uploaded_file() 函数将源文件移动到另一个位置。您只是不能将同一个文件移动两次。
作为替代解决方案,您可以将移动的文件复制到第二个位置。
$outputOther = copy($move_to, $move_to_site);