src/Filesystem/Flysystem.php
public function upload($key, UploadedFile $file, $overwrite = false)
    {
        try {
            $this->uploadToFlysystem($key, $file);
        } catch (FileExistsException $exception) {
            if (!$overwrite) {
                throw new \RuntimeException(sprintf('The file with key "%s" is exists.', $key));
            }
            $this->filesystem->delete($key);
            $this->uploadToFlysystem($key, $file);
        }
        @unlink($file->getPathname()); //remove old
        return true;
    }
public function upload($key, UploadedFile $file, $overwrite = false)
    {
        try {
            $this->uploadToFlysystem($key, $file);
        } catch (FileExistsException $exception) {
            if (!$overwrite) {
                throw new \RuntimeException(sprintf('The file with key "%s" is exists.', $key));
            }
            $this->filesystem->delete($key);
            $this->uploadToFlysystem($key, $file);
        }
        @unlink($file->getPathname()); //remove old
        return true;
    }
public function upload ( $ key , UploadedFile $ file , $ overwrite = false ) { try { $ this -> uploadToFlysystem ( $ key , $ file ) ; } catch ( FileExistsException $ exception ) { if ( ! $ overwrite ) { throw new \ RuntimeException ( sprintf ( 'The file with key "%s" is exists.' , $ key ) ) ; } $ this -> filesystem -> delete ( $ key ) ; $ this -> uploadToFlysystem ( $ key , $ file ) ; } @ unlink ( $ file -> getPathname ( ) ) ; //remove old return true ; }
{@inheritdoc}
{