diff --git a/ChangeLog b/ChangeLog index 8bca106a4..ca1e008e1 100755 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,9 @@ $Source$ * main.php3: - lines 425-426: form is submitted with post method; - 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 * db_stats.php3: fixed the sql query so that the script won't die, even if diff --git a/tbl_dump.php3 b/tbl_dump.php3 index 03478ded3..db59c0fd8 100755 --- a/tbl_dump.php3 +++ b/tbl_dump.php3 @@ -98,25 +98,29 @@ if (empty($asfile)) { // Download else { - // Defines filename and extension + // Defines filename and extension, and also mime types if (!isset($table)) { $filename = $db; } else { $filename = $table; } if (isset($bzip) && $bzip == 'bzip') { - $ext = 'bz2'; + $ext = 'bz2'; + $mime_type = 'application/x-bzip'; } else if (isset($gzip) && $gzip == 'gzip') { - $ext = 'gz'; + $ext = 'gz'; + $mime_type = 'application/x-gzip'; } else if ($what == 'csv' || $what == 'excel') { - $ext = 'csv'; + $ext = 'csv'; + $mime_type = 'text/x-csv'; } else { - $ext = 'sql'; + $ext = 'sql'; + $mime_type = 'application/octetstream'; } // Send headers - header('Content-Type: application/octetstream'); - header('Content-Disposition: filename="' . $filename . '.' . $ext . '"'); + header('Content-Type: ' . $mime_type); + header('Content-Disposition: attachment; filename="' . $filename . '.' . $ext . '"'); header('Pragma: no-cache'); header('Expires: 0'); } // end download