function nativeCopy($path, $newPath)
    {
        if (!$this->createDir(Util::dirname($newPath), new Config())) {
            return false;
        }

        $location    = $this->applyPathPrefix($this->encodePath($path));
        $newLocation = $this->applyPathPrefix($this->encodePath($newPath));

        try {
            $destination = $this->client->getAbsoluteUrl($newLocation);
            $response    = $this->client->request('COPY', '/' . ltrim($location, '/'), null, [
                'Destination' => $destination,
            ]);

            if ($response['statusCode'] >= 200 && $response['statusCode'] < 300) {
                return true;
            }
        } catch (NotFound $e) {
            // Would have returned false here, but would be redundant
        }

        return false;
    }
function nativeCopy($path, $newPath)
    {
        if (!$this->createDir(Util::dirname($newPath), new Config())) {
            return false;
        }

        $location    = $this->applyPathPrefix($this->encodePath($path));
        $newLocation = $this->applyPathPrefix($this->encodePath($newPath));

        try {
            $destination = $this->client->getAbsoluteUrl($newLocation);
            $response    = $this->client->request('COPY', '/' . ltrim($location, '/'), null, [
                'Destination' => $destination,
            ]);

            if ($response['statusCode'] >= 200 && $response['statusCode'] < 300) {
                return true;
            }
        } catch (NotFound $e) {
            // Would have returned false here, but would be redundant
        }

        return false;
    }
function nativeCopy ( $ path , $ newPath ) { if ( ! $ this -> createDir ( Util :: dirname ( $ newPath ) , new Config ( ) ) ) { return false ; } $ location = $ this -> applyPathPrefix ( $ this -> encodePath ( $ path ) ) ; $ newLocation = $ this -> applyPathPrefix ( $ this -> encodePath ( $ newPath ) ) ; try { $ destination = $ this -> client -> getAbsoluteUrl ( $ newLocation ) ; $ response = $ this -> client -> request ( 'COPY' , '/' . ltrim ( $ location , '/' ) , null , [ 'Destination' => $ destination , ] ) ; if ( $ response [ 'statusCode' ] >= 200 && $ response [ 'statusCode' ] < 300 ) { return true ; } } catch ( NotFound $ e ) { // Would have returned false here, but would be redundant } return false ; }
Copy a file through WebDav COPY method.

@param string $path
@param string $newPath

@return bool
Copy a file through WebDav COPY method .