andy7789
asked on
php: extracting large files from zip archives
Hi X-perts,
I need to extract a large file (about 100mb a single file) from a zip archive. I have been trying PclZip class and it works fine on relatively small files - even for huge archives of 500mb. However it does not work for a single large file (no warnings, no messages whatsoever). Here is my current code with PclZip
<?php
require_once('pclzip.lib.p hp');
set_time_limit(600);
$local_file = 'current_data_full.zip';
$archive = new PclZip('current_data_full. zip');
if ($archive->extract(PCLZIP_ OPT_PATH, 'raw_data') == 0) {
die("Error : ".$archive->errorInfo(true ));
}
?>
I tried another class - http://www.lost-in-code.com/2007/05/15/php-upload-extract-zip-archive/. It only creates a zero-length file.
I also tried direct unix unzip execution as
<?
exec('unzip cur.zip');
?>
This is the only code working for large files so far.
Please, advise some other zip classes working for huge files. I am using php 4.4.2
Another question, if I use exec('unzip ...'), it takes 5-10 sec to execute. How can I make sure that the file is fully extracted before continuing the script?
Thanks
A
I need to extract a large file (about 100mb a single file) from a zip archive. I have been trying PclZip class and it works fine on relatively small files - even for huge archives of 500mb. However it does not work for a single large file (no warnings, no messages whatsoever). Here is my current code with PclZip
<?php
require_once('pclzip.lib.p
set_time_limit(600);
$local_file = 'current_data_full.zip';
$archive = new PclZip('current_data_full.
if ($archive->extract(PCLZIP_
die("Error : ".$archive->errorInfo(true
}
?>
I tried another class - http://www.lost-in-code.com/2007/05/15/php-upload-extract-zip-archive/. It only creates a zero-length file.
I also tried direct unix unzip execution as
<?
exec('unzip cur.zip');
?>
This is the only code working for large files so far.
Please, advise some other zip classes working for huge files. I am using php 4.4.2
Another question, if I use exec('unzip ...'), it takes 5-10 sec to execute. How can I make sure that the file is fully extracted before continuing the script?
Thanks
A
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER