I created a routine to create a zip file of a folder in PHP that is working, but inside the zip is created the entire folder structure on the server and I do not want it to create so, I would like you to create only with the files of folder.
The function that checks the files is this:
$NomesArquivos = array();
function lista_arquivos($dir) {
global $NomesArquivos;
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && is_file($dir.'/'.$file)) {
$NomesArquivos[] = $dir.'/'.$file;
}
}
closedir($handle);
}
return $NomesArquivos;
}
lista_arquivos($caminhopasta);
What do I need to change?