Forum


Replies: 9   Views: 1609
How to use the streammode?
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 pwctechnicalsecurity  · 02-04-2021 - 14:44

Hi, thanks for all the suggestions.

Do you have a working example of a Laravel streamed download for a merged file?

Would it be something like this?

return response()->streamDownload(function () use ($merge) {
    echo $merge->mergeDocx($queue[0], array(), 'example.docx', array());
}, 'filenamexxx');

It must has something to do with 

  • The DOCX file is not valid and it is not possible to open it. This is the most common issue about corrupted documents, and it means that the web server or PHP are adding extra content to the file at the beginning or the end, e.g when it is downloaded. It is possible to see those additional contents by opening the DOCX with a hex-editor. This way you can trace their origin and thus prevent them to be added.

Especially, since I am basically not adding any content to my DocX in the example. Besides the working Laravel example, are there any reknown PHP / Web Server things that generally cause these issues? E.g. are there any examples to the statement that help me pinpoint the issue?