zip64 support in php?

青春壹個敷衍的年華 提交于 2019-12-08 04:54:37

问题


I have a file downloaded by a cron that is in zip64 format.

How can I unzip it using php or via a php cmd()?


回答1:


surprisingly unix's unzip just worked!

exec(unzip -n -q zip-downloaded-by-cron.zip -d photos);



回答2:


A couple options that I know of.

If your PHP runs on Windows you can use the COM interface to DotNetZip.

$zipInput = "c:\\temp\\zip-downloaded-by-cron.zip"; 
$zip = new COM("Ionic.Zip.ZipFile");
$zip->Initialize($zipInput);
$dirForExtract= "c:\\temp\\extract";
# optional password 
$zip->Password = "AES-Encryption-Is-Secure";
$zip->ExtractAll($dirForExtract);
$zip->Dispose();

For DotNetZip, ZIP64 is automatically used when necessary, when reading in a zip file.

Alternatively, you can invoke the command-line tool provided with DotNetZip. This has the advantage of working on Linux+Mono, in addition to Windows+.NET. The tool is unzip.exe, and you can just invoke (cmd) unzip.exe downloaded-zip.zip. It will automatically handle the zip64 stuff. There are options on unzip.exe to specify where to extract, which files to extract, and so on.




回答3:


Apparently Perl's IO::Compress::Zip module supports Zip64. If you're comfortable enough to install it you could call a small Perl script via shell_exec().



来源:https://stackoverflow.com/questions/1675535/zip64-support-in-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!