In a webpage I am making a tar.gz file to download to the user. The file gets to the user perfectly fine but in the process I make a .tar archive and .tar.gz file on the server. I am able to delete the tar.gz file with 'unlink($targzFile);' but I am not able to delete the archive. I have tried treating the archive like a folder and removing all items in the folder and then deleting the folder with 'rmdir($folderName);' as seend below but that hasn't worked for me.
$files = glob($tarName. "/database/*");
foreach($files as $file)
{
if(is_file($file))
unlink($file);
}
rmdir($tarName . "/database");
rmdir($tarName);
Does anyone have any suggestions? Thanks.