/** * Copies the object to another container/object * * Note that this function, because it operates within the Object Store * itself, is much faster than downloading the object and re-uploading it * to a new object. * * @param DataObject $target the target of the COPY command */ public function Copy(Dataobject $target) { $uri = sprintf('/%s/%s', $target->Container()->Name(), $target->Name()); $this->debug('Copying object to [%s]', $uri); $response = $this->Service()->Request($this->Url(), 'COPY', array('Destination' => $uri)); // check response code if ($response->HttpStatus() > 202) { throw new Exceptions\ObjectCopyError(sprintf(Lang::translate('Error copying object [%s], status [%d] response [%s]'), $this->Url(), $response->HttpStatus(), $response->HttpBody())); } return $response; }