Al crear zips dinamicament con php si hay muchos archivos me lo crea y cuando termina me da error y me dice que el archivo está dañado.
Con pocos archivos me funciona perfectamente.
A alguien más le ha pasado? Solución?
Utilizo la clase de:
Código:
/*
Zip file creation class
makes zip files on the fly...
use the functions add_dir() and add_file() to build the zip file;
see example code below
by Eric Mueller
http://www.themepark.com
v1.1 9-20-01
- added comments to example
v1.0 2-5-01
initial version with:
- class appearance
- add_file() and file() methods
- gzcompress() output hacking
by Denis O.Philippov, [email protected], http://www.atlant.ru
*/
// official ZIP file format: http://www.pkware.com/appnote.txt
class zipfile
{
var $datasec = array(); // array to store compressed data
var $ctrl_dir = array(); // central directory
var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; //end of Central directory record
var $old_offset = 0;
function add_dir($name)
// adds "directory" to archive - do this before putting any files in directory!
// $name - name of directory... like this: "path/"
// ...then you can add files using add_file with names like "path/file.txt"
{
$name = str_replace("\\", "/", $name);
$fr = "\x50\x4b\x03\x04";
$fr .= "\x0a\x00"; // ver needed to extract
$fr .= "\x00\x00"; // gen purpose bit flag
$fr .= "\x00\x00"; // compression method
$fr .= "\x00\x00\x00\x00"; // last mod time and date
$fr .= pack("V",0); // crc32
$fr .= pack("V",0); //compressed filesize
$fr .= pack("V",0); //uncompressed filesize
$fr .= pack("v", strlen($name) ); //length of pathname
$fr .= pack("v", 0 ); //extra field length
$fr .= $name;