1

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);
Priyashree Bhadra
  • 3,182
  • 6
  • 23
  • Are you getting an error? – emrdev Mar 26 '22 at 05:56
  • Does this answer your question? [How to make tmp writable for cakephp in GAE(Google App Engine)?](https://stackoverflow.com/questions/28472077/how-to-make-tmp-writable-for-cakephp-in-gaegoogle-app-engine) – new name Mar 26 '22 at 12:50
  • Can you check if [this](https://cloud.google.com/appengine/docs/standard/php7/using-temp-files)and [this article](https://cloudplatform.googleblog.com/2014/02/php-app-engine-apps-and-file-system.html) helps you? – Priyashree Bhadra Mar 29 '22 at 10:46

0 Answers0