title: cant download zip file from php function
body: <p>am calling this function to create and download zip. the create is working but my screen freezes when the system is about to download it, then shows a bunch of abstract writings without download</p>
  
  <pre><code>function zipF(){
  $track = $_POST['track'];
  $cartid = $_POST['cartid'];
  
  $zip = new ZipArchive;
      if ($zip-&gt;open('myzip.zip',  ZipArchive::CREATE)) {
          $notan = DataDB::getInstance()-&gt;select_from_where('order_image','cartid',$cartid);  
          foreach($notan as $row){
          $zip-&gt;addFile('../img/tempfil/'.$row['image'], $row['image']);
          }
          $zip-&gt;close();
          $archive_file_name ="myzip.zip";
         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");
        echo '&lt;div class="alert alert-danger"&gt;
                              &lt;strong&gt;Error!&lt;/strong&gt; Problem with your order details.'.$track.'
              &lt;/div&gt;';
         } else {
           echo 'Failed!';
         }
   }
  </code></pre>