Forum


Replies: 6   Views: 2884
Createdocx::$streammode creates a corrupt file
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by sam3d  · 17-12-2017 - 00:41

Using the latest Premium version...

We don't want to save files on the server, so we are setting 

CreateDocx::$streamMode = true;

From your examples, we can run this successfully: ...\examples\Templates\processTemplate\sample_1.php

If we change: 

$docx->createDocx('example_processTemplate_1');

To: 

$docx->createDocxAndDownload('example_processTemplate_1');

It downloads the file and creates a copy on the server. 

But if we change it to : 

CreateDocx::$streamMode = true;
$docx->createDocxAndDownload('example_processTemplate_1');

Then the resulting download shows a corrupt warning when opening in MS Word. 

This issue occurs on a vagrant localhost and on our server.  It occurs in both Chrome and Firefox. 

How can we avoid saving a file on the server and receive an uncorrupted file ?