Re: php force MP3 'save as' dialog
- From: "Steve" <no.one@xxxxxxxxxxx>
- Date: Wed, 24 Jan 2007 14:58:15 -0600
| 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;
.
- Follow-Ups:
- Re: php force MP3 'save as' dialog
- From: Karl
- Re: php force MP3 'save as' dialog
- References:
- php force MP3 'save as' dialog
- From: mail
- php force MP3 'save as' dialog
- Prev by Date: php force MP3 'save as' dialog
- Next by Date: Re: Http_output
- Previous by thread: php force MP3 'save as' dialog
- Next by thread: Re: php force MP3 'save as' dialog
- Index(es):
Relevant Pages
|