I'm new to coding and i am trying to figure out how to zip and download multiple folders after selecting them via a series of check boxes.
However i keep getting the " ZipArchive::close(): Can't open file: Permission denied on line 21" whenever i try to run the code.
<?php
if (isset($_POST['dwnld'])) {
//create ana array
$ar=array();
$checked=$_POST['dwnld'];
for ($i=0; $i <count($checked) ; $i++) {
$f="../Docs/".$checked[$i];
$ar[$i]=$f;
}
$files = $ar;
$zipname = 'file.zip';
$zip = new ZipArchive;
$zip->open($zipname, ZipArchive::CREATE);
foreach ($files as $file) {
$zip->addFile($file);
}
$zip->close();
}
?>
Any advise is welcomed.
Aucun commentaire:
Enregistrer un commentaire