I am generating a .zip file in php with zipArchive and I have a problem and even though the file is automatically downloaded to the PC, it is also stored internally in the server. Surely it is silly but I do not give with the key, to see if you can help me. I leave the zip generation code. Thank you very much
if ($ num_docs! = 0) {
$archivoZip = $zip->open( $zipname, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE );
$zip->open($zipname, ZIPARCHIVE::CREATE );
$zip->addEmptyDir($exp['num_exp']);
do
{
if($archivoZip==true){
$zip->addFile("documentacion/" . $exp['num_exp']."/" . $doc['fichero'], $exp['num_exp']."/" . $doc['fichero']);
}
}while($doc = mysql_fetch_assoc($docs));
$zip->close();
}
///DESCARGANDO EL ZIP
header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.$zipname);
readfile($zipname);