Hello, I resolve like this : clicking on the link the user is taken to another page, and is passed by the URL variable with the ID desired .. so
###
if ($_GET[id])
{
$value_de= $_GET[id];
$dl_full = "/var/spool/asterisk/monitor"."/".$value_de;
$dl_name=$value_de;
if (!file_exists($dl_full))
{
echo gettext("ERROR: Cannot download file ".$dl_full.", it does not exist.<br>");
exit();
}
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$dl_name");
header("Content-Length: ".filesize($dl_full));
header("Accept-Ranges: bytes");
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-transfer-encoding: binary");
readfile($dl_full);
exit();
}
###
This works great !!
But i still Having troubles when i try to delete the archive...in the system the user haves the option to delete the archive
I tried to simply replace the function readfile () above by unlink () but did not work ...
How should I proceed to get to a unlink ()? which would require putting headers?
I've tried to create an Apache Alias of the directory, called sound, using the alias i can acess directily the directory and i can open files too. but.. still doesnt working to delete the archive.
like this
####
Using apache alias
###
//http://201.88.53.234/sound/
// THIS IS THE APACHE ALIAS, I HAVE DIRECT ACCESS TO THE DIRECTORY #/VAR/SPOOL/ASTERISK/MONITOR#
if(isset($GET['id'])):
$del_id = $GET['id'].".gsm";
$del_path = "http://201.88.53.234/sound/".$del_id;
endif;
//Trigger
if(isset($POST['MM_del']) && $POST['MM_del'] == "MM_del"):
if(is_file($del_path)):
unlink($del_path) or die("Não foi possível excluir o arquivo !!!");
endif;
header("Location:painel.php?inc=gerencia_conta&reset=0&pg=0&sort=starttime&sentido=ASC");
endif;
#####
i receive no error messages, and the DIE() function isn't triggered, it seems the unlink() function run ok, but dont runs cause the archive still there.
Thanks by the help