header(Content-disposition:...) question
Posted: Tue Jul 04, 2006 2:43 pm
Hi,
I'm building an application to force downloads of files from the server using the following function:
However, I want the HTML page behind it to change, so that I can display a confirmation message. Is there anyway to do this? It seems the browser stops processing right after it finishes this function.
Thanks.
I'm building an application to force downloads of files from the server using the following function:
Code: Select all
function downloadFile($fileName, $path)
{
ob_clean();
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Length: ' . filesize($path.$fileName));
header('Content-Disposition: attachment; filename=' . $fileName . '');
header("Cache-Control: cache, must-revalidate");
header('Pragma: ');
$contents = file_get_contents($path.$fileName);
echo $contents;
ob_end_flush();
}Thanks.