Re: push data directlly to the client(was Creating zip files)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shawn McKenzie wrote:
It flance wrote:
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?

Thanks

Yes. 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

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;

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux