Re: push data directlly to the client(was Creating zip files)
| From: | Shawn McKenzie | Date: | Tue, 08 Jul 2008 20:54:50 +0000 |
| Subject: | Re: push data directlly to the client(was Creating zip files) | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276464@lists.php.net to get a copy of this message | ||
Shawn McKenzie wrote:
It flance wrote:So I searched for it again but didn't test: $zipedresult = $zipfile->zipped_file(); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=SomeFileName.zip"); header("Content-Type: application/zip"); header("Content-Transfer-Encoding: binary"); echo $zipedresult;Hi, Thank you for your answer. Now i figured out how to build the zip archive. I am using a class that returns the compressed data: $zipedresult = $zipfile->zipped_file(); This data, i can write it to a file. but i would like to make it downloadable without having to store it in the server. Is that possible? ThanksYes. Now that you have the zip file contents, send the correct headers to the browser for content-type and disposition, etc using header(), then echo $zipedresult. I can never remember the header to send I have to look it up most times. -Shawn