title: codeigniter zip crashes the zip file content
body: <p>I’m using this…</p>
  
  <pre><code>$resumePath = APPPATH."../public/uploads/resume/";
  
  //print_r($fileNames);
  //Array ( [0] =&gt; 1.docx [1] =&gt; 1.docx [2] =&gt; 3.docx [3] =&gt; 4.docx [4] =&gt; 5.docx [5] =&gt; 7.docx [6] =&gt; 8.docx [7] =&gt; 9.docx [8] =&gt; 10.docx [9] =&gt; 10.docx )
  
          $this-&gt;load-&gt;library('zip');
          foreach ($fileNames as $files) {
              if (is_file($resumePath . $files)) {
                  $this-&gt;zip-&gt;read_file($resumePath . $files);
              }
          }
          $this-&gt;zip-&gt;download('backup.zip');
  </code></pre>
  
  <p>It works fine, but when i try to unzip with Winzip or Winrar. it show me:</p>
  
  <p><code>C:\Users\User\Downloads\backup.zip: The archive is either in unknown format or damaged
  </code>
  <img src="https://i.stack.imgur.com/0qJOA.png" alt="enter image description here"></p>
  
  <p><strong>Zip File Curruped is Solved but now I am getting the file is currupted inside the zip archive...i mean after extracting when i open the doxc file its showing me file is currupted or damaged..and one more thing the size of the doxc file is now showing <code>45</code> or <code>55</code> where as when downloading with <code>read_file</code> the size is showing properly(ex: in the image above)..but now its showing only two digit number...please help any one..</strong></p>
  
  <p>Updated Code: </p>
  
  <p>the below code allow me to extract but when i open docx file it shows file is damaged::</p>
  
  <pre><code> foreach ($fileNames as $files) {
              if (is_file($resumePath . $files)) {
                  **$this-&gt;zip-&gt;add_data($files, $resumePath . $files);**
              }
          }
  </code></pre>
  
  <p>the below code showing right size of the file but not allowing me to extract the file:</p>
  
  <pre><code>foreach ($fileNames as $files) {
              if (is_file($resumePath . $files)) {
                  **$this-&gt;zip-&gt;add_data($files, file_get_contents($resumePath . $files));**
              }
          }
  </code></pre>
  
  <p>any ideas.. would be a great help... thanks in advance</p>