Skip to content
Advertisement

Create a zip file and download it

I am trying to download a 2 files by creating the zip file on local-server.the file is downloaded in zip format but when i try to extract it.it gives error: End-of-central-directory signature not found. Either this file is not a zip file, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zip file comment will be found on the last disk(s) of this archive.

the following code i am using for this:

JavaScript

i checked the values of all variables which are passing into the function,all are fine.so please look this.Thanks in advance.

Advertisement

Answer

Add Content-length header describing size of zip file in bytes.

JavaScript

Also make sure that there is absolutely no white space before <? and after ?>. I see a space here:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement