Can I zip files using relative paths?
For example:
$zip->addFile('c:/wamp/www/foo/file.txt');
the ZIP should have a directory structure like:
foo
-> file.txt
and not:
wamp
-> www
-> foo
-> file.txt
like it is by default...
ps: my full code is here (I'm using ZipArchive to compress contents of a directory into a zip file)
See the addFile()
function definition, you can override the archive filename:
$zip->addFile('/path/to/index.txt', 'newname.txt');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With