function UploadedFile::moveTo
Overrides UploadedFileInterface::moveTo
File
-
vendor/
guzzlehttp/ psr7/ src/ UploadedFile.php, line 162
Class
Namespace
GuzzleHttp\Psr7Code
public function moveTo($targetPath) : void {
$this->validateActive();
if (false === self::isStringNotEmpty($targetPath)) {
throw new InvalidArgumentException('Invalid path provided for move operation; must be a non-empty string');
}
if ($this->file) {
$this->moved = PHP_SAPI === 'cli' ? rename($this->file, $targetPath) : move_uploaded_file($this->file, $targetPath);
}
else {
Utils::copyToStream($this->getStream(), new LazyOpenStream($targetPath, 'w'));
$this->moved = true;
}
if (false === $this->moved) {
throw new RuntimeException(sprintf('Uploaded file could not be moved to %s', $targetPath));
}
}