Josegonzalez\Upload\File\Writer\DefaultWriter::writeFile PHP Метод

writeFile() публичный Метод

Writes a set of files to an output
public writeFile ( League\Flysystem\FilesystemInterface $filesystem, string $file, string $path ) : boolean
$filesystem League\Flysystem\FilesystemInterface a filesystem wrapper
$file string a full path to a temp file
$path string that path to which the file should be written
Результат boolean
    public function writeFile(FilesystemInterface $filesystem, $file, $path)
    {
        $stream = @fopen($file, 'r');
        if ($stream === false) {
            return false;
        }
        $success = false;
        $tempPath = $path . '.temp';
        $this->deletePath($filesystem, $tempPath);
        if ($filesystem->writeStream($tempPath, $stream)) {
            $this->deletePath($filesystem, $path);
            $success = $filesystem->rename($tempPath, $path);
        }
        $this->deletePath($filesystem, $tempPath);
        fclose($stream);
        return $success;
    }