By coping extensively form moodle/mod/data/preset.php (rows 500..502)
I wrote the following code:
$basedir = path to the folder with files to zip
$tozip = array of names of files found in $basedir
foreach ($tozip as $key => $filename) {
$tozip[$key] = $basedir . '/' . $tozip[$key];
}
$exportfile = a_path_I_like/a_name_I_like.zip;
file_exists($exportfile) && unlink($exportfile);
$status = zip_files($tozip, $exportfile);
This routine works, but... why do I find inside my zip file only files and not their container folder?
Why do Martin code creates the folder too?
Where am I wrong?
Where is this code different from the code of Martin?
Thank you in advance.
General developer forum
zip file without folder
This discussion has been locked so you can no longer reply to it.