Forum


Replies: 6   Views: 3059
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 - 13:17

Thank you.  We can now run ...\examples\Templates\processTemplate\sample_1.php  using $streamMode without a corrupt file error. 

But if we change sample_1 to use a simple form, we still get a corrupt file error when we open the download:

<?php

if ( isset( $_POST['tester'] ) )  {
        
        require_once '../../../classes/CreateDocx.inc';

        $docx = new CreateDocxFromTemplate('../../files/TemplateVariables.docx');

        $variables = $docx->getTemplateVariables();
        $docx->processTemplate($variables);

        CreateDocx::$streamMode = true;

        $docx->createDocx('TEST');

}

?>

<br>-----TEST----<br><br>

<form action="" method="post">

        <input type="hidden" name="tester" value="1" >
        
        <input type="submit" value="Submit">
        
</form>

If we use the same form but remove $streamMode and use $docx->createDocxAndDownload instead, the download is not corrupted, but we have a copy in our fs.