Hi, does anyone happen to know how to NOT store the path in the zip file? I am pulling files from a UNIX file path because they are not in the webpath, so my zip ends up with /var, /www .. etc as folders and all I need are the files with no paths.
Bas de Ruiter - 2012-06-13 12:29:00 - In reply to message 1 from Henry Wills
I too found this anoying.
After searching for a solution to this, I eventually cam up with the simple solution to just first go to the directory before zipping the file.
<?php
// the input file
$file = '/path/to/file.txt';
$path = pathinfo($file, PATHINFO_DIRNAME);
$filename = basename($file);
// first change directory
chdir($path);
// then create zip file
require_once 'EasyZip.php';
$zip = new EasyZip();
$zip->addFile($filename);
$zip->zipFile('/path/to/zipfile.zip');
?>