Hello,
I am trying to remove excess directories from an uploaded zip file.
For example I would like to transform :
/folder1/folder2/folder3/ [Files are in this folder]
to
/folder1/[files are in this folder]
Any help would be appreciated, Thanks.
Hello,
I am trying to remove excess directories from an uploaded zip file.
For example I would like to transform :
/folder1/folder2/folder3/ [Files are in this folder]
to
/folder1/[files are in this folder]
Any help would be appreciated, Thanks.
edit:
what I have so far is
function zip_extract($file, $extractPath)
{
$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE)
{
$zip->extractTo($extractPath);
$zip->close();
return TRUE;
}
else
{
return FALSE;
}
}
I'm not sure how to go about removing the unwanted directories though.