improved mime types and http headers used when exporting dumps to files
This commit is contained in:
@@ -13,6 +13,9 @@ $Source$
|
|||||||
* main.php3:
|
* main.php3:
|
||||||
- lines 425-426: form is submitted with post method;
|
- lines 425-426: form is submitted with post method;
|
||||||
- lines 431-447: languages are sorted by their true names.
|
- lines 431-447: languages are sorted by their true names.
|
||||||
|
* tbl_dump.php3, lines 101-123: improved mime types and http headers used
|
||||||
|
when exporting dumps to files thanks to Dan Allen &
|
||||||
|
Ignacio Vazquez-Abrams.
|
||||||
|
|
||||||
2001-08-28 Olivier M<>ller <om@omnis.ch>
|
2001-08-28 Olivier M<>ller <om@omnis.ch>
|
||||||
* db_stats.php3: fixed the sql query so that the script won't die, even if
|
* db_stats.php3: fixed the sql query so that the script won't die, even if
|
||||||
|
@@ -98,25 +98,29 @@ if (empty($asfile)) {
|
|||||||
|
|
||||||
// Download
|
// Download
|
||||||
else {
|
else {
|
||||||
// Defines filename and extension
|
// Defines filename and extension, and also mime types
|
||||||
if (!isset($table)) {
|
if (!isset($table)) {
|
||||||
$filename = $db;
|
$filename = $db;
|
||||||
} else {
|
} else {
|
||||||
$filename = $table;
|
$filename = $table;
|
||||||
}
|
}
|
||||||
if (isset($bzip) && $bzip == 'bzip') {
|
if (isset($bzip) && $bzip == 'bzip') {
|
||||||
$ext = 'bz2';
|
$ext = 'bz2';
|
||||||
|
$mime_type = 'application/x-bzip';
|
||||||
} else if (isset($gzip) && $gzip == 'gzip') {
|
} else if (isset($gzip) && $gzip == 'gzip') {
|
||||||
$ext = 'gz';
|
$ext = 'gz';
|
||||||
|
$mime_type = 'application/x-gzip';
|
||||||
} else if ($what == 'csv' || $what == 'excel') {
|
} else if ($what == 'csv' || $what == 'excel') {
|
||||||
$ext = 'csv';
|
$ext = 'csv';
|
||||||
|
$mime_type = 'text/x-csv';
|
||||||
} else {
|
} else {
|
||||||
$ext = 'sql';
|
$ext = 'sql';
|
||||||
|
$mime_type = 'application/octetstream';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send headers
|
// Send headers
|
||||||
header('Content-Type: application/octetstream');
|
header('Content-Type: ' . $mime_type);
|
||||||
header('Content-Disposition: filename="' . $filename . '.' . $ext . '"');
|
header('Content-Disposition: attachment; filename="' . $filename . '.' . $ext . '"');
|
||||||
header('Pragma: no-cache');
|
header('Pragma: no-cache');
|
||||||
header('Expires: 0');
|
header('Expires: 0');
|
||||||
} // end download
|
} // end download
|
||||||
|
Reference in New Issue
Block a user