Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 24th, 2012  |  syntax: None  |  size: 0.44 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How do you force a file to download from Amazon S3 using the Amazon SDK for PHP?
  2. header("Content-type: $filetype");
  3. header("Content-Disposition: filename="".$filename.""");
  4. $response = $s3->get_object(AMAZON_BUCKET, $filepath);  
  5. echo $response->body;
  6.        
  7. $response = $s3->get_object(AMAZON_BUCKET, $filepath, array(
  8.       'response' => array(
  9.         'content-type' => $filetype,
  10.         'content-disposition' => 'attachment'
  11.        )
  12.     ));