Link to home
Create AccountLog in
Avatar of springfresh
springfresh

asked on

Add password on Zip via PHP

i tried this suggestion: https://www.experts-exchange.com/questions/22848474/Password-Protect-Zip-File-Using-PHP.html

But, it didn't worked. What should i try :/
Avatar of hernst42
hernst42
Flag of Germany image

what does not work with that solution?
which OS is the webserver running?
Avatar of springfresh
springfresh

ASKER

i am running on windows. I i am installed WAMP server on windows VISTA
zip must be in the PATH and the webserver must be able to write to the directory where WAMP is running.
Check your permissions and pathes.
well, i am doing like that:
And it creates .zip file, but do not add password :/
$zip = new ZipArchive();
$filename = $username.'-'.$date.'-'.$random.'.zip';
 
if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
}
 
$zip->addFromString($date."-textfile.txt", "Works!\n");
echo system('zip -P bla '.$filename);
$zip->close();

Open in new window

hm, aha i see now, that i need zip.exe in that dir. But where can i download free version. I tried from http://www.info-zip.org/Zip.html#Win32 . But i dont know which one should i download. I am using windows Vista
ASKER CERTIFIED SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
thanks, worked!