title: Set Content-Type dynamically
body: <p>I have the following code, which i'm using to force download of files rather than opening in browser.</p>
  
  <pre><code>if(isset($_POST['file_name'])){
  $player_file = $_POST['file_name'];
  $accessKey = "REMOVED";
  $secretKey = "REMOVED";
  $bucket = $_POST['bucket'];
  $fname = $_POST['fname'];
  
  $zip_url = el_s3_getTemporaryZipLink($accessKey, $secretKey, $bucket, $fname);
  $mp3_url = el_s3_getTemporaryMP3Link($accessKey, $secretKey, $bucket, $fname);    
  
  
  header('Content-type: audio/mpeg3');
  header('Content-Disposition: attachment; filename="themixtapesite_'.$player_file.'"');
  readfile($mp3_url);
  exit();
  }
  </code></pre>
  
  <p>As you can see, i pass all the variables from a form. Then use that information to generate a unique Signed URL for the file stored on Amazon S3.</p>
  
  <p>If the file is an MP3 i need it to use the $mp3_url and if it's a Zip file i need to use the $zip_url.</p>
  
  <p>This has to be really simple, but i've been sat in front of this screen all day now i've got a complete mind blank!</p>
  
  <p>Any help appreciated.</p>