title: Saving file in Zend
body: <p>I am trying to save a file that I edit in zend. In fact that is document.xml, a part of .docx ducument. I take a docx file, extract document.xml, do some changes in the content and want to show pop up dialogue box to save new file or open it.<br>
  The result is almost ok, but instead of zip pack I receive a text file with zip extension where in content I can find in fact zipped  files but within view/layout content.<br>
  My code is like below:  </p>
  
  <pre><code>$zip = New ZipArchive();
     $newReportFilename = "Report_" . date('Y-m-d_H-i-s') . ".docx";
     $dir = getcwd();
     $templateLocation = "$dir\\report_template.docx";
     $tempFile = "$dir\\$newReportFilename";
         copy($templateLocation,$tempFile);
  
  $zip-&gt;open($tempFile);
  $fp = $zip-&gt;getStream("word/document.xml");
      while (!feof($fp)) {
          $fileContent .= fread($fp, 2);
      }
  
  fclose($fp);   
  $fileContent = "... some xml content ...";
  
  $zip-&gt;addFromString("word/document.xml", $fileContent);
  $zip-&gt;close()
  
  header("Content-Type: application/zip");
  header("Content-Length: " . filesize("$dir\\$newReportFilename"));
  header("Content-Disposition: attachment; filename=\"Reportfile.zip\"");
  readfile("$dir\\$newReportFilename");  
  </code></pre>
  
  <p>and something like this I receive in output file:</p>
  
  <pre><code>... 
  &lt;form id="createReport" name="createReport" enctype="application/x-www-form-urlencoded" method="post" action=""&gt;&lt;dl class="zend_form"&gt;
  &lt;dt id="runId-label"&gt;&lt;label for="runId" class="optional"&gt;Run ID&lt;/label&gt;&lt;/dt&gt;
  &lt;dd id="runId-element"&gt;
  &lt;input type="text" name="runId" id="runId" value="81"&gt;&lt;/dd&gt;
  &lt;dt id="submit-label"&gt;&amp;#160;&lt;/dt&gt;&lt;dd id="submit-element"&gt;
  &lt;input type="submit" name="submit" id="submit" value="Dalej"&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;/form&gt;okPK¶     ! 8+-?¦  s   [Content_Types].xml ó(                                                                                         ¦V-n¦0+F?+¥éó¦£C¦$@¦¤á+ò-û/Éd-¦v,¡X(YGF"@vf+3+-=~oM±1injvS-XNzÑ¦ªf++-»¼H(£¦;¿++_}¦¦\ñé¬]¬+1|p&lt;+-Xæ*+-¢+G+Énpå! ë=¦+GÄKnûÿ1+j·HóVP&lt;ëê¤-¤±Q±+{t!U¦èn]]ª«Ö-h)Éä=gº+HK¯¦Zé=rgë¬-p!z )--¼¬zF/Ü»û?á§;â+-=id+-hw§¬7=+në=â¦£ßk¢¢öƒ¤+¦V8-nf+&amp;éIgE+¥Y§Uv¢¦:ñæ&gt;ì¢=+¯ï&amp;˜ì+++p+fN/Op;¦@ñt||+zFI¤fÄ+w+ô(a+L=vBô@~=Eº|^mS9VáJv 5(+üê¶Ç+-  
  y8°²-âxs)±-I~  
  ...
  </code></pre>
  
  <p>Some experiments with text files only gave me the same result which is, inside a file I got I see view/layout content with some text given by me.<br>
  The whole editing and zipping works fine when I just save the file in a disk, but I would like the user to decide what to do with this by save as dialogue box.  </p>
  
  <p>Do you know how to get rid of this view/layout content?<br>
  And get the file only.</p>