below code works well on my local server (XAMPP), however when i deploy on the app engine, it fails to read the docx file. It seems for some reason readDocx function is not able to access the temporary file to get the content, however it works on the local server with no issues.
function readDocx($filename)
{
$zip = new ZipArchive();
echo $filename;
if ($zip->open($filename)) {
$content = $zip->getFromName("word/document.xml");
$zip->close();
$content = str_replace('</w:r></w:p></w:tc><w:tc>', " ", $content);
$content = str_replace('</w:r></w:p>', "\r\n", $content);
return strip_tags($content);
}
return False;
}
$file=$_FILES["file"]["tmp_name"];
$textContent=readDocx($file);