I've got a problem with the class : ZipArchive.
My ZIP file is well created and my folders and files are in the archive.
However, I've got 2 problems:
- I can't extract a file from the generated archive unless if the file is located on the root of the archive;
- If I extract the entire archive, the tree is deleted, the files are all at the same level, while the tree is good if I browse the archive with an archive manager;
I've tried to creating the folders first with $archive->addEmptyDir
, but it doesn't change anything.
I think that It's an Index problem or something like this but I'm not sure.
Here's my code:
$archive = new ZipArchive;
foreach($files as $file_origin_path) {
if($error === FALSE) {
$error = !$archive->addFile($file_origin_path, str_ireplace($path, '', $file_origin_path));
}
}
$archive->close();
Would anyone have a way that would allow me to move forward?