Description
Hi,
I am trying to develop a solution for template processing. I tried with following code.
<?php
require_once 'includes/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($target_file);
?>
But I get following when I tried to read a word file with permission 0644. File path is correct.
Fatal error: Uncaught exception 'PhpOffice\PhpWord\Exception\Exception' with message 'The filename uploads/input/2748cv.docx is not recognised as an OLE file' in /home2//public_html/xxx.xx/FL/xxx/sc/includes/PhpWord/Shared/OLERead.php:80 Stack trace: #0
/home2//public_html/xxx.xx/FL/xxx/sc/includes/PhpWord/Reader/MsDoc.php(131): PhpOffice\PhpWord\Shared\OLERead->read('uploads/input/2...') #1
/home2//public_html/xxx.xx/FL/xxx/sc/includes/PhpWord/Reader/MsDoc.php(115): PhpOffice\PhpWord\Reader\MsDoc->loadOLE('uploads/input/2...') #2
/home2//public_html/xxx.xx/FL/xxx/sc/includes/PhpWord/IOFactory.php(78): PhpOffice\PhpWord\Reader\MsDoc->load('uploads/input/2...') #3
/home2//public_html/xxx.xx/FL/xxx/sc/download.php(49): PhpOffice\PhpWord\IOFactory::load('uploads/input/2...', 'MsDoc') #4 {main} thrown in
/home2//public_html/xxx.xx/FL/xxx/sc/includes/PhpWord/Shared/OLERead.php on line 80
It will be a great help if you can help me to overcome this issue. Also the solution must support both *.doc and *.docx formats.
Thank you.