Forum


Replies: 2   Views: 1890
Change mime content-type
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 admin  · 09-03-2021 - 09:26

Hello,

UPDATE: phpdocx 14.5 reordered the default base template to return Microsoft Word 2007+ mime type using CreateDocx.

A DOCX file is a ZIP file, so application/octet-stream is a correct MIME for a DOCX file; ZipArchive, used to create the DOCX files, generates that mime. If you want to set other MIME you can use header functions from PHP when sending/downloading the documents (as createDocxAndDownload does) or you can try changing the magic setup in your server:

https://stackoverflow.com/questions/6595183/docx-file-type-in-php-finfo-file-is-application-zip

As you are using a Premium license, you can also use the stream mode (https://www.phpdocx.com/api-documentation/performance/zip-stream-docx-with-PHP).

If you are using an external service that requires application/vnd.openxmlformats-officedocument.wordprocessingml.document as mime type, we recommend you to contact them to know how to set other mime type to their service (as PHP header function allows).

Regards.