improved the patch Marc commited about headers send to enforce download of dump files

This commit is contained in:
Loïc Chapeaux
2001-09-06 07:15:33 +00:00
parent da620d8be5
commit bff031d299
2 changed files with 10 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
<?php
/* $Id$ */
/**
* Formats the INSERT statements depending on the target (screen/file) of the
* sql dump
@@ -114,13 +115,18 @@ else {
$mime_type = 'text/x-csv';
} else {
$ext = 'sql';
$mime_type = 'application/octetstream';
// loic1: 'application/octet-stream' is the registered IANA type but
// MSIE and Opera seems to prefer 'application/octetstream'
$mime_type = (USR_BROWSER_AGENT == 'IE' || USR_BROWSER_AGENT == 'OPERA')
? 'application/octetstream'
: 'application/octet-stream';
}
// Send headers
// we need "inline" instead of "attachment" for IE 5.5
header('Content-Type: ' . $mime_type);
header('Content-Disposition: inline; filename="' . $filename . '.' . $ext . '"');
// lem9: we need "inline" instead of "attachment" for IE 5.5
$content_disp = (USR_BROWSER_AGENT == 'IE') ? 'inline' : 'attachment';
header('Content-Disposition: ' . $content_disp . '; filename="' . $filename . '.' . $ext . '"');
header('Pragma: no-cache');
header('Expires: 0');
} // end download