开发者

zip64 support in php?

I ha开发者_如何学编程ve a file downloaded by a cron that is in zip64 format.

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


surprisingly unix's unzip just worked!

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


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.


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().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜