• support@answerspoint.com

How to create ZIP archives using PHP and download

1706

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 9 years ago
  • G John

1Answer


0

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"); 
readfile("$archive_file_name");

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

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

Your Answer

    Facebook Share        
       
  • asked 9 years ago
  • viewed 1706 times
  • active 9 years ago

Best Rated Questions