Headers that makes the browser download the file.
Moderator: General Moderators
Headers that makes the browser download the file.
I'm making a database backuper and I want for the user to be able to download the sql query file afterwards. Which headers do I send in this case to the browser?
what do you send? The result of an export likeif so I suggest CXII. Zlib Compression Functions and the mime-type is application/x-gzip or application/zip
Code: Select all
CREATE TABLE `whatever` (
....
) TYPE=MyISAM;
....
INSERT INTO whatever VALUES("1", "2");
INSERT INTO whatever VALUES("2", "3");
....really depends on the average file size.
If bandwidth and/or storage is not the problem you can try it withfirst....
If bandwidth and/or storage is not the problem you can try it with
Code: Select all
<?php
$filename = 'export.sql'; // e.g.
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$filename);
readfile($filename);?>