Hello guy!!!

I need some hlep
I am using the ziparchive class in a very simple mode:

zip = new ZipArchive();
$file= $filename.'.zip';

if ($zip->open($file, ZIPARCHIVE::CREATE)===TRUE) {
    $zip->addFile($filename, $filename); //insert the file ciao.txt into the archive
    $zip->close();
}else echo "Error in creating archive";

$filename is the file to cpmpress (es.: db-backup-1282308611-3389dae361af79b04c9c8e7057f60cc6.sql)

If I run the srcipt, I don't get any error, but php creates 2 compressed files called:

db-backup-1282308652-3389dae361af79b04c9c8e7057f60cc6.sql.zip.a04688
db-backup-1282308652-3389dae361af79b04c9c8e7057f60cc6.sql.zip.b04688

If I rename the files, I can verify that everything is correct but...why that strange extension?
If I restart the apache service the extensioon changes, it seemes something with Apache PID.

Could you please help me?

    The first thing that I see is that you are using $filename in too many places. You are opening/creating a zip file and then trying to add it to itself.

      Write a Reply...