i used ZipArchive::EM_TRAD_PKWARE, with password, but zip file is not encrypted. I think that pkware not working. Have solutions ?
Thx
$zip->setEncryptionName('test.txt', ZipArchive::EM_TRAD_PKWARE, 'PASSWORD');
i used ZipArchive::EM_TRAD_PKWARE, with password, but zip file is not encrypted. I think that pkware not working. Have solutions ?
Thx
$zip->setEncryptionName('test.txt', ZipArchive::EM_TRAD_PKWARE, 'PASSWORD');
I got it working by the following example and rules:
I got inconsistent results when not following these 2 rules:
addFile
is called before setEncryptionName
Create the following test.txt file with the following content:
test
Add the following PHP code to test.php:
$zip = new ZipArchive();
$zip->open("test.zip", ZipArchive::CREATE);
$zip->addFile("test.txt");
$zip->setEncryptionName('test.txt', ZipArchive::EM_TRAD_PKWARE, 'PASSWORD');
$zip->close();
php test.php
A zip file is now created which prompts for a password on unzip.