Re: php force MP3 'save as' dialog



| 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;



.



Relevant Pages

  • Re: (old v2.4) squid problem.
    ... HTTP/1.1 400 Bad Request ... IIRC Squid doesn't support re-writing of the user-agent (although ... If you want to fix it at your end, ... the browser to use HTTP/1.1 as Dave suggests - IME this has no impact ...
    (uk.comp.os.linux)
  • Re: Maxthon unter wine?
    ... bei Doppelklick auf die Programm-Icons hüpfen diese KDE-gewohnt, ... IIRC ist Maxthon kein eigenständiger Browser, ...
    (de.comp.os.unix.linux.misc)
  • Re: Classifm Daily Quiz 15/6
    ... website crashes my browser. ... Today's clue (iirc) was: He dropped Ambrose ...
    (uk.rec.competitions)
  • Re: Eurosign in text
    ... > when I'm writing it to a text-file it's converted ... IIRC, if the encoding system of the browser is other than unicode ...
    (comp.lang.php)
  • Re: Making the most of our browsers
    ... become available after loading before launching the Wimp_SendMessage call. ... After launching the browser and before issuing the Wimp_SendMessage, ... Investigate TaskManager_EnumerateTasks (IIRC the name of the SWI to ...
    (comp.sys.acorn.programmer)