public function updateMetadata(Object $obj) {
    //$url = $this->url . '/' . rawurlencode($obj->name());
    $url = self::objectUrl($this->url, $obj->name());
    $headers = array();

    // See if we have any metadata. We post this even if there
    // is no metadata.
    $md = $obj->metadata();
    if (!empty($md)) {
      $headers = self::generateMetadataHeaders($md, Container::METADATA_HEADER_PREFIX);
    }
    $headers['X-Auth-Token'] = $this->token;

    // In spite of the documentation's claim to the contrary,
    // content type IS reset during this operation.
    $headers['Content-Type'] = $obj->contentType();

    $client = \HPCloud\Transport::instance();

    // The POST verb is for updating headers.
    $response = $client->doRequest($url, 'POST', $headers, $obj->content());

    if ($response->status() != 202) {
      throw new \HPCloud\Exception('An unknown error occurred while saving: ' . $response->status());
    }
    return TRUE;
  }
public function updateMetadata(Object $obj) {
    //$url = $this->url . '/' . rawurlencode($obj->name());
    $url = self::objectUrl($this->url, $obj->name());
    $headers = array();

    // See if we have any metadata. We post this even if there
    // is no metadata.
    $md = $obj->metadata();
    if (!empty($md)) {
      $headers = self::generateMetadataHeaders($md, Container::METADATA_HEADER_PREFIX);
    }
    $headers['X-Auth-Token'] = $this->token;

    // In spite of the documentation's claim to the contrary,
    // content type IS reset during this operation.
    $headers['Content-Type'] = $obj->contentType();

    $client = \HPCloud\Transport::instance();

    // The POST verb is for updating headers.
    $response = $client->doRequest($url, 'POST', $headers, $obj->content());

    if ($response->status() != 202) {
      throw new \HPCloud\Exception('An unknown error occurred while saving: ' . $response->status());
    }
    return TRUE;
  }
public function updateMetadata ( Object $ obj ) { //$url = $this->url . '/' . rawurlencode($obj->name()); $ url = self :: objectUrl ( $ this -> url , $ obj -> name ( ) ) ; $ headers = array ( ) ; // See if we have any metadata. We post this even if there // is no metadata. $ md = $ obj -> metadata ( ) ; if ( ! empty ( $ md ) ) { $ headers = self :: generateMetadataHeaders ( $ md , Container :: METADATA_HEADER_PREFIX ) ; } $ headers [ 'X-Auth-Token' ] = $ this -> token ; // In spite of the documentation's claim to the contrary, // content type IS reset during this operation. $ headers [ 'Content-Type' ] = $ obj -> contentType ( ) ; $ client = \ HPCloud \ Transport :: instance ( ) ; // The POST verb is for updating headers. $ response = $ client -> doRequest ( $ url , 'POST' , $ headers , $ obj -> content ( ) ) ; if ( $ response -> status ( ) != 202 ) { throw new \ HPCloud \ Exception ( 'An unknown error occurred while saving: ' . $ response -> status ( ) ) ; } return TRUE ; }
Update an object's metadata.

This updates the metadata on an object without modifying anything
else. This is a convenient way to set additional metadata without
having to re-upload a potentially large object.

Swift's behavior during this operation is sometimes unpredictable,
particularly in cases where custom headers have been set.
Use with caution.

@param object $obj HPCloud::Storage::ObjectStorage::Object
The object to update.

@retval boolean
@return boolean
TRUE if the metadata was updated.

@throws HPCloud::Transport::FileNotFoundException
if the object does not already exist on the object storage.
Update an object s metadata .