• support@answerspoint.com

How to create ZIP archives using PHP and download


I want to create a zip file using PHP and download 
The script that system converts the selected files into ZIP file format and download on my sytem

  • PHP

  • asked 7 years ago
  • G John



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

header("Content-type: application/zip"); 
header("Content-Disposition: attachment; filename=$archive_file_name");
header("Content-length: " . filesize($archive_file_name));
header("Pragma: no-cache"); 
header("Expires: 0"); 

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

$file_names = array('iMUST Operating Manual V1.3a.pdf','iMUST Product Information Sheet.pdf');
  • answered 7 years ago
  • B Butts

Your Answer

    Facebook Share        
  • asked 7 years ago
  • viewed 1340 times
  • active 7 years ago

Best Rated Questions