Skip to content

Instantly share code, notes, and snippets.

@jamiehannaford
Created April 22, 2014 09:07
Show Gist options
  • Save jamiehannaford/11171148 to your computer and use it in GitHub Desktop.
Save jamiehannaford/11171148 to your computer and use it in GitHub Desktop.
<?php
// Method 1: Retrieve file details using HEAD
$file = $container->getObject('foo.jpg');
// Method 2: Only set the name (which is the only requirement for an update)
$file = $container->dataObject();
$file->setName('foo.jpg');
// Now update content
$handle = fopen('/path/to/new/content', 'r+');
$file->setContent($handle);
$file->update();
fclose($handle);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment