Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to convert files to zip and make it available for user to download, this zip files are created at runtime.
For this i m using code from
http://www.9lessons.info/2012/06/creating-zip-file-with-php.html?m=1
It works fine but when size of zip created is large ie 30 mb, i am unable to download as downloaded filze size is just 1 or 2 kb
(Instead of 30 mb),though zip file created on server is about 30mb
What could be problem
Posted

1 solution

Please use: http://php.net/manual/en/book.zip.php[^].

To provide a ZIP file on the fly, directly in HTTP response (without storing a file and using HTTL anchor element), specify the HTTP header 'Content-type: application/zip':
header('Content-type: application/zip');


Please see also:
http://en.wikipedia.org/wiki/Media_type[^],
http://www.iana.org/assignments/media-types[^].

—SA
 
Share this answer
 
Comments
Espen Harlinn 25-Apr-13 19:25pm    
5'ed!
Sergey Alexandrovich Kryukov 25-Apr-13 19:44pm    
Thank you, Espen.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900