title: How create a file csv after zip file that csv and save file zip at server
body: <p>I want to create a file csv after zip this file csv and save file zip at server.
  I code as:</p>
  
  <pre><code> foreach($list as $item)
          { 
              $csv .= join("\t", $item)."\r\n"; 
          }  
  
          $csv = chr(255).chr(254).mb_convert_encoding($csv,"UTF-16LE","UTF-8");
  
          header("Content-type: application/x-msdownload");
          header("Content-disposition: csv; filename=CSV_".date("YmdHis").".csv; size=".strlen($csv));
  
          $zip = new ZipArchive();
          $zip_name ="CSV_".$dateTimeNow.".zip"; // Zip name
          if($zip-&gt;open($zip_name, ZIPARCHIVE::CREATE)!==TRUE)
          {                         
                $error .= "* Sorry ZIP creation failed at this time";
          }
          $zip-&gt;addFile($csv);
          $zip-&gt;close();
  </code></pre>
  
  <p>file csv has created ok, but zip file and save file still not sucesssfull.
  Can you help me? Thanks.</p>