Move an uploaded file to it's intended destination.
The file can be an actual uploaded file object or the path to
a resized image file on disk.

@param  UploadedFile $file
@param  string $filePath
@return void
514689
public function move($file, $filePath)
	{
 		$this->getS3Client()->putObject(['Bucket' => $this->getBucket(), 'Key' => $filePath, 'SourceFile' => $file, 'ContentType' => $this->attachedFile->contentType(), 'ACL' => $this->attachedFile->ACL]);
	}
351662
protected function onSetUploadedFile(?UploadedFileInterface $uploadedFile = null): void
    {
        $this->file = $uploadedFile;

        parent::onSetUploadedFile();
    }
692704
public function processUploadedFile($originalFile, $newFile, $folder)
    {
        if (substr($folder, -1) != '/') $folder = $folder . '/';
        @move_uploaded_file($originalFile, $folder . $newFile) or die("File: '{$originalFile}' couldn't be moved '{$folder}'.");
        @chmod($folder . $newFile, 0777) or die("Error with chmod() function on file: '{$newFile}' in folder '{$folder}'.");
    }
226035
public function handleUploadedFiles(UploadedFile $file, $extension, $dir)
    {
        $original_file = $file->getClientOriginalName();
        $path_parts = pathinfo($original_file);

        $increment = '';
        while (file_exists($dir . FileManager::DS . $path_parts['filename'] . $increment . '.' . $extension)) {
            $increment++;
        }

        $basename = $path_parts['filename'] . $increment . '.' . $extension;
        $file->move($dir, $basename);
    }
574841
public function saveToFile($filePath)
    {
        $this->adsUtilityRegistry->addUtility(
            AdsUtility::REPORT_DOWNLOADER_FILE
        );
        $this->reportDownloadResultDelegate->saveToFile($filePath);
    }
8144
public function loadFile($filePath) {
        require_once (substr($filePath, 0, 1) != '/' && substr($filePath, 1, 1) != ':')
            ? $this->basePath . DIRECTORY_SEPARATOR . $filePath : $filePath;
    }
213849
public function moveTo(string $path): bool
	{
		if($this->hasError())
		{
			throw new UploadException(vsprintf('%s', [$this->getErrorMessage()]), $this->getErrorCode());
		}

		if($this->isUploaded() === false)
		{
			throw new UploadException('The file that you\'re trying to move was not uploaded.', -1);
		}

		return $this->moveUploadedFile($path);
	}
1059771
function move( $dstPath )
    {
        $dstPath = self::cleanPath( $dstPath );
        $srcPath = $this->filePath;

        eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::fileMove( '$srcPath', '$dstPath' )" );

        self::$dbbackend->_rename( $srcPath, $dstPath );

        $this->metaData = null;
    }
164691
public function move($destination) {
		$destination = $this->getDestination($destination);

		if (@rename($this->getPathname(), $destination)) {
			$this->pathname = $destination;
		} else {
			throw new FileException(sprintf('Failed to move %s to %s', $this->pathname, $destination));
		}
	}
878455
protected function move(UploadFile $file, $targetPath)
    {
        $fileInfo = [
            'name' => pathinfo($targetPath, PATHINFO_BASENAME),
            'path' => $targetPath,
            'mime' => $file->getFileMime(),
            'size' => $file->getSize(),
        ];

        $file->moveTo($targetPath);

        if ( ! $file->getError()) {
            $this->uploadedFiles[] = $fileInfo;
        } else {
            $this->errors[] = $file->getError();
        }
    }
365903
protected function removeTemporaryFiles($filepath, $force = false)
	{
		if ($force || $filepath !== $this->getUncompressedFilepath($filepath)) {
			$this->getBackupFilesystemInstance()->removeFile($this->getUncompressedFilepath($filepath));
		}
	}
1294208
public function moveTo($targetPath)
        {
            if ($this->moved) {
                throw new \RuntimeException('Uploaded file already moved');
            }

            if (!is_string($targetPath) || $targetPath === '') {
                throw new \InvalidArgumentException('Target path must be a non empty string');
            }

            $stream = $this->getStream();
            $file   = $stream->getMetadata('uri');

            if (is_dir($targetPath)) {
                
                if (!is_writable($targetPath)) {
                    throw new \InvalidArgumentException('Target path is not writable');
                }
                $target = rtrim($targetPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $this->clientFilename;
                
            } else {
                
                if (!is_writable(dirname($targetPath))) {
                    throw new \InvalidArgumentException('Target path is not writable');
                }
                $target = $targetPath;

            }
            
            if (!copy($file, $target)) {
                throw new \RuntimeException(sprintf('Error coping uploaded file %1s to %2s', $this->clientFilename, $targetPath));
            }
        
            $this->moved = true;
            if (!$this->moved) {
                throw new \RuntimeException(sprintf('Uploaded file could not be moved to %s', $targetPath));
            }
        }
272218
public function setFile(UploadedFile $file = null)
    {
        $this->file = $file;

        if (null === $this->getFile()) {
            return null;
        }

        // check if we have an old image path
        if (isset($this->path)) {
            // store the old name to delete after the update
            $this->temp = $this->path;
            $this->path = null;
        } else {
            $this->path = 'initial';
        }

        return $this;
    }
782776
public function uploadFileWithFolderAndName(UploadedFile $file, $folderPath, $fileName)
    {

        $folderPath = !empty($folderPath) ?   $folderPath  . '/' : '';
        $path =   $this->env . '/' . $folderPath . $fileName . '.'. $file->guessClientExtension();
        /** @var Result $result */
        $result = $this->client->putObject([
            'ACL' => 'public-read',
            'Bucket' => $this->bucketName,
            'SourceFile' => $file->getRealPath(),
            'Key' => $path
        ]);
        
        return new FileUploadedModel($path, $result->get('ObjectURL'), FileUploadedModel::VENDOR_S3);
    }
1296263
private function moveFileToExternalStorage($filePath,Folder $folder = null)
	{
		$oldPath = $this->getInternalPath() . $filePath;
		$newPath = $this->getExternalPath() . $filePath;

		$this->createBothFoldersInFileSystem($folder);

		if ( ! rename($oldPath, $newPath)) {
//			throw new Exception\RuntimeException('Failed to move file to the public storage');
			$filename = basename($newPath);
			$this->container->getLogger()->warn('Failed to move file (' . $filename . ') to the public storage');
		}
	}
317060
protected function saveUploadedFile(UploadedFile $file, $path)
    {
        $file->move($path, $filename = $this->getUploadedFilename($file));

        return $filename;
    }
477508
public static function appendToFile(string $filePath, string $content, bool $withoutDuplicates = true): void
	{
		if ($withoutDuplicates && self::fileContains($filePath, $content)) {
			return;
		}

		self::insertIntoFile($filePath, $content, FILE_APPEND);
	}