lib/Beberlei/AzureBlobStorage/BlobClient.php
public function copyBlob($sourceContainerName = '', $sourceBlobName = '', $destinationContainerName = '', $destinationBlobName = '', $metadata = array(), $sourceSnapshotId = null, $destinationLeaseId = null, $additionalHeaders = array())
    {
        Assertion::notEmpty($sourceContainerName, 'Source container name is not specified.');
        self::assertValidContainerName($sourceContainerName);
        Assertion::notEmpty($sourceBlobName, 'Source blob name is not specified.');
        self::assertValidRootContainerBlobName($sourceContainerName, $sourceBlobName);

        Assertion::notEmpty($destinationContainerName, 'Destination container name is not specified.');
        self::assertValidContainerName($destinationContainerName);
        Assertion::notEmpty($destinationBlobName, 'Destination blob name is not specified.');
        self::assertValidRootContainerBlobName($destinationContainerName, $destinationBlobName);

        $headers = array();
        if (!is_null($destinationLeaseId)) {
            $headers['x-ms-lease-id'] = $destinationLeaseId;
        }
        $headers = array_merge($headers, $this->generateMetadataHeaders($metadata));

        foreach ($additionalHeaders as $key => $value) {
            $headers[$key] = $value;
        }

        $sourceResourceName = self::createResourceName($sourceContainerName, $sourceBlobName);
        if (!is_null($sourceSnapshotId)) {
            $sourceResourceName .= '?snapshot=' . $sourceSnapshotId;
        }
        $destinationResourceName = self::createResourceName($destinationContainerName, $destinationBlobName);

        $headers["x-ms-copy-source"] = '/' . $this->accountName . '/' . $sourceResourceName;

        $response = $this->performRequest($destinationResourceName, array(), 'PUT', $headers, false, null, self::RESOURCE_BLOB, self::PERMISSION_WRITE);
        if ( ! $response->isSuccessful()) {
            throw new BlobException($this->getErrorMessage($response, 'Resource could not be accessed.'));
        }

        return new BlobInstance(
            $destinationContainerName,
            $destinationBlobName,
            null,
            $response->getHeader('Etag'),
            $response->getHeader('Last-modified'),
            $this->getBaseUrl() . '/' . $destinationContainerName . '/' . $destinationBlobName,
            0,
                '',
                '',
                '',
            false,
            $metadata
        );
    }
public function copyBlob($sourceContainerName = '', $sourceBlobName = '', $destinationContainerName = '', $destinationBlobName = '', $metadata = array(), $sourceSnapshotId = null, $destinationLeaseId = null, $additionalHeaders = array())
    {
        Assertion::notEmpty($sourceContainerName, 'Source container name is not specified.');
        self::assertValidContainerName($sourceContainerName);
        Assertion::notEmpty($sourceBlobName, 'Source blob name is not specified.');
        self::assertValidRootContainerBlobName($sourceContainerName, $sourceBlobName);

        Assertion::notEmpty($destinationContainerName, 'Destination container name is not specified.');
        self::assertValidContainerName($destinationContainerName);
        Assertion::notEmpty($destinationBlobName, 'Destination blob name is not specified.');
        self::assertValidRootContainerBlobName($destinationContainerName, $destinationBlobName);

        $headers = array();
        if (!is_null($destinationLeaseId)) {
            $headers['x-ms-lease-id'] = $destinationLeaseId;
        }
        $headers = array_merge($headers, $this->generateMetadataHeaders($metadata));

        foreach ($additionalHeaders as $key => $value) {
            $headers[$key] = $value;
        }

        $sourceResourceName = self::createResourceName($sourceContainerName, $sourceBlobName);
        if (!is_null($sourceSnapshotId)) {
            $sourceResourceName .= '?snapshot=' . $sourceSnapshotId;
        }
        $destinationResourceName = self::createResourceName($destinationContainerName, $destinationBlobName);

        $headers["x-ms-copy-source"] = '/' . $this->accountName . '/' . $sourceResourceName;

        $response = $this->performRequest($destinationResourceName, array(), 'PUT', $headers, false, null, self::RESOURCE_BLOB, self::PERMISSION_WRITE);
        if ( ! $response->isSuccessful()) {
            throw new BlobException($this->getErrorMessage($response, 'Resource could not be accessed.'));
        }

        return new BlobInstance(
            $destinationContainerName,
            $destinationBlobName,
            null,
            $response->getHeader('Etag'),
            $response->getHeader('Last-modified'),
            $this->getBaseUrl() . '/' . $destinationContainerName . '/' . $destinationBlobName,
            0,
                '',
                '',
                '',
            false,
            $metadata
        );
    }
Copy blob

@param string $sourceContainerName       Source container name
@param string $sourceBlobName            Source blob name
@param string $destinationContainerName  Destination container name
@param string $destinationBlobName       Destination blob name
@param array  $metadata                  Key/value pairs of meta data
@param string $sourceSnapshotId          Source snapshot identifier
@param string $destinationLeaseId        Destination lease identifier
@param array  $additionalHeaders         Additional headers. See http://msdn.microsoft.com/en-us/library/dd894037.aspx for more information.
@return object Partial blob properties
@throws BlobException