V
V
v3shin2020-11-24 16:16:38
PHP
v3shin, 2020-11-24 16:16:38

How to fix ZipArchive::ER_MULTIDISK on Windows?

Greetings. There is a code that creates a zip archive:

$zip = new \ZipArchive();
$zipName = 'archive.zip';
$zipFileName = '/path/' . $zipName;
$code = $zip->open($zipFileName, \ZipArchive::CREATE);
if (is_resource($zip)) {
    // сделать что-то
} else {
    echo 'Не получилось создать архив.' . $code;
    exit;
}


The result is "Failed to create archive.1", which corresponds to the error ZipArchive::ER_MULTIDISK (Multi-disk zip archives not supported). How to fix it on Windows?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
v3shin, 2020-11-26
@v3shin

Apparently, it was necessary to restart the car. And the paths to prescribe normally:

$zip->addFile(__DIR__ . '/' . $filename); // не так
$zip->addFile(__DIR__ . '/' . $filename, $filename); // а так

The problem went away by itself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question