0
I created a routine to create a zip file of a folder in PHP that is working, but within the zip is created the entire existing folder structure on the server and I do not want you to create so, I would like you to create only with the files in the 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 I need to change?
Describe better what the "server folder structure" would be, please.
– Woss
It creates the zip with folders /var/www/[site-name]/wp-content/... and so on to the PDF and XML files.
– Pablo Zanata