Forum


Replies: 2   Views: 2918
Broken file on download, but ok on writing to disk?
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 fishka_bmk  · 03-10-2016 - 18:58

Hello, I'm trying to create page, which will answer with a docx file.

This page creating file fine with "$docx->createDocx('file');". But  once i change it to "$docx->createDocxAndDownload('file');" file appears to be broken. And word cannot open it. Only one line change does this.

Any suggestions?

Posted by admin  · 04-10-2016 - 06:33

Hello,

The method createDocxAndDownload included in phpdocx uses generic headers to download the files. It these headers don't work on your server, we recommend you to check if your server is returning the right content type for DOCX files or use the method createDocx with custom headers or the function ob_start from PHP.

As you are using the trial package, after you have bought a license, please write to contact[at]phpdocx.com and the dev team will help you.

Regards.

Posted by fishka_bmk  · 04-10-2016 - 13:11

Got the problem: server was also outputted debug info, which went into the file contents. Removed that output and all things now fine =)