Я пытаюсь сохранить файлы из одной папки в другую. zip, размещенном в другом каталоге. И я написал следующие коды:
archive.php
<?php
$zip = new ZipArchive();
$zip->open('example.zip', ZipArchive::CREATE);
$srcDir = "/home/sam/uploads/";
$files= scandir($srcDir);
//var_dump($files);
unset($files[0],$files[1]);
foreach ($files as $file) {
$zip->addFile("{$file}");
}
$zip->close();
?>
Но, к сожалению, я не могу создать .zip-папку. Есть ли какой-то шаг, который я пропустил?