title: Download files as attachement with .zip archieve
body: <p>I am having this function in my class name MyMethods:</p>
  
  <pre><code>function zipDownload($file_names,$file_path){
      $zip_file_name = date('Y-m-d-h-i-s').'_attachement.zip';
      $zip = new ZipArchive();
      if($zip-&gt;open($zip_file_name, ZIPARCHIVE::CREATE )!==TRUE) {
          echo("cannot open &lt;".$zip_file_name."&gt;\n");     
          }
      else{
          $filePathAry = explode("/",$file_path);
          $count = count($filePathAry);
          $path = '';
          for($i=0; $i&lt;=$count - 2; $i++){
              $path .= $filePathAry[$i].'/';
              }
          $path = $this-&gt;baseDir().$path;
          foreach($file_names as $files){
              $zip-&gt;addFile($path,$files);
              }
          $zip-&gt;close();      
          header("Content-type: application/zip"); 
          header("Content-Disposition: attachment; filename=".$zip_file_name); 
          header("Pragma: no-cache"); 
          header("Expires: 0"); 
          readfile($zip_file_name);
          exit;   
          }   
      }
  </code></pre>
  
  <p>I am calling this by the following code from presentation layer:</p>
  
  <pre><code>//filled array with names of files:
  loop over files name{
           $filesAry[] = $fileName;
           }
  $method-&gt;zipDownload($filesAry,$zipPath);
  </code></pre>
  
  <p>on debugging i get this link as an individual file path:</p>
  
  <pre><code> Path : http://localhost/sites/mySite/bdc/uploader/exhibitsFiles/06_08_2014
   File Name: xyb.jpg
  </code></pre>
  
  <p>after clicking on the download all file as attachment, it produces .zip file but it does not open as normal .zip file?</p>
  
  <p>What i am missing? please help me in this. thanks.</p>