Question:
I have a PHP script that creates csv file from the db. I would like to have the script to create the csv data and immediately make a .gzip file available for download. Can you please give me some ideas?
Answer:
You can easily apply gzip compression with the gzencode function.
1 2 3 4 5 6 |
<? header("Content-Disposition: attachment; filename=your_file_name.xml.gz"); header("Content-type: application/x-gzip"); echo gzencode($csvToCompress); ?> |