Hi all.
I got a form button that has to download 2 files. One is a pdf as output of from Pdf Report and one is PNG.
Until today I did only the pdf and it was working.
Today I added a png file and no way to download them both in the same time.
If I reverse the code it download only the png.
How can I fix this issue ??
CODE:
//PDF FILE
$sql_id ="SELECT id_ticket
FROM ticket
WHERE id_ticket_progr
= " . {id_ticket_progr};
sc_lookup(rs_ID, $sql_id);
if (isset({rs_ID[0][0]})) // Row found
{
[glo_id_ticket]={rs_ID[0][0]};
}
//echo "VARIABILE NR TICKET BUTTON " . [glo_id_ticket] ;
sc_redir(pdfreport_ticket , [glo_id_ticket] , ‘_parent’);
//PNG that has to be download togheter the pdf just in case of IF … = Y
if([glo_covid19] == “Y”)
{
$path = realpath(dirname(__FILE__) . '/..');
//$file_name = "Doc_Covid19.png";
$file_name ="grp__NM__img__NM__Doc_Covid19.png";
$file_path_name = $path . "/_lib/img/" . $file_name;
$new_filename = "Covid_19_Eos.png";
if (file_exists($file_path_name)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
//header('Content-Disposition: attachment; filename='.basename($file_path_name));
header('Content-Disposition: attachment; filename="' . $new_filename . '"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file_path_name));
ob_clean();
flush();
readfile($file_path_name);
//exit;
}
}