Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Could not create a temporary file with unique name in the specified directory" of .docx file with images #1819

Open
Abelkrown opened this issue Feb 6, 2020 · 1 comment

Comments

@Abelkrown
Copy link

Describe the Bug

When i try to load .docx file with image i get an exception
PHP Fatal error: Uncaught exception 'PhpOffice\\PhpWord\\Exception\\CreateTemporaryFileException' with message 'Could not create a temporary file with unique name in the specified directory.' in .../vendor/phpoffice/phpword/src/PhpWord/Element/Image.php:485\nStack trace:\n#0 .../vendor/phpoffice/phpword/src/PhpWord/Element/Image.php(411): PhpOffice\\PhpWord\\Element\\Image->getArchiveImageSize('zip:https://testII.do...')\n#1 .../vendor/phpoffice/phpword/src/PhpWord/Element/Image.php(149): PhpOffice\\PhpWord\\Element\\Image->checkImage()\n#2 [internal function]: PhpOffice\\PhpWord\\Element\\Image->__construct('zip:https://testII.do...', NULL, false, NULL)\n#3 .../vendor/phpoffice/phpword/src/PhpWord/Element/AbstractContainer.php(145): ReflectionClass->newInstanceArgs(Array)\n#4 [internal function]: PhpOffice\\PhpWord\\Element\\AbstractContainer->addElement('Image', 'zip: in .../vendor/phpoffice/phpword/src/PhpWord/Element/Image.php on line 485

In the same time if i delete all images from .docx file and try to load same .docx without images - all works perfectly.

Steps to Reproduce

<?php
require __DIR__ . '/vendor/autoload.php';

$phpWord = IOFactory::load('test.docx');

Where 'test.docx' - file with images.

Expected Behavior

The possibility to extract text from file (Don't care about images).

Current Behavior

Unable to open file and get error "Could not create a temporary file with unique name in the specified directory."

Context

  • PHP Version: 7.0
  • PHPWord Version: 0.17.0
@Niroj11
Copy link

Niroj11 commented Feb 7, 2020

I am also having an issue creating a docx file in the storage directory.

PHPWord: v0.17.*
LaravelL 5.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants