Skip to content

Instantly share code, notes, and snippets.

@pmeissner
Created January 10, 2012 03:08
Show Gist options
  • Save pmeissner/1586631 to your computer and use it in GitHub Desktop.
Save pmeissner/1586631 to your computer and use it in GitHub Desktop.
<?
public static function generate_url($file_key) {
$s3 = self::get_s3();
$link = ArclightAWSExpiring_Link::create()->where('file_key = ?', $file_key)->find();
if (!$link)
throw new Phpr_ApplicationException('We are sorry, but the link could not be found');
return $s3->get_object_url(self::$configuration->bucket, $file_key, '10 Seconds',
array('response' => array('content-disposition' => 'attachment; filename=' . $link->file_name))
);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment