Cenzo
Cenzo

Reputation: 3

PHP Unzip issue ZipArchive extractTo not creating Folders

when i'm extacting a zip-Archive that contains a subfolder with some Images in it, then the directory is not created. Instead the Directory-Name is now part of the filename ?!

This makes no sense to me at all?

ImageFiles\

The Result of extractTo would be a file in the root directory named 'ImagesFiles\Image1.jpg'

Any ideas on how to create this ImageFile folder when extracting the files ?

Thanks in advance

Upvotes: 0

Views: 286

Answers (1)

Alef Mim
Alef Mim

Reputation: 1

This problem happens because DIRECTORY_SEPARATOR is different in Windows and Linux.

You can replace the separator value with the separator of the operating system before extracting using a loop and functions getNameIndex and renameIndex and function str_replace.

Upvotes: 0

Related Questions