|
Posted by Steve on 01/24/07 20:58
| if(ini_get('zlib.output_compression')) {
| ini_set('zlib.output_compression', 'Off'); }
takes longer to check the 'if' condition than to just call
ini_set()...setting it 'off' has no effect when it is 'off' and, has the
correct effect when it is 'on'. further, iirc, if it is 'on', it comes to
the browser compressed but the browser uncompresses it once it is all
received. if the browser doesn't support compression, none of this matters
anyway.
| header("Pragma: public");
| header("Expires: 0");
| header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
| header("Cache-Control: private",false);
| header("Content-Type: audio/x-mp3");
| header("Content-Disposition: attachment;
| filename=\"".basename($FileURL)."\";" );
| header("Content-Transfer-Encoding: binary");
| header("Content-Length: ".filesize($FileURL));
these are the headers i usually use...although i have used force-download
before as well (sorry for the wrapping):
require_once 'site.cfg.php';
$fileData = '';
$fileName = $_REQUEST['fileName'];
$filePath = $site->uploadBaseDirectory;
if ($fileName != ''){ $fileData = @file_get_contents($filePath .
$fileName); }
header('pragma: public' );
header('expires: 0' );
header('cache-control: private', false );
header('cache-control: must-revalidate, post-check=0, pre-check=0' );
header('content-disposition: attachment; filename="' . $fileName . '"' );
header('content-size: ' . count($fileData) );
header('content-transfer-encoding: binary' );
header('content-type: application/octet-stream' );
echo $fileData;
[Back to original message]
|