amrigo
05-26-2006, 09:15 AM
Hi
I have a forcing download script that work fine for images and pdf´s and doc´s.
It forces the download dialog box when clicking on the link.
Now i want to force the download of a dinamic page generated from a mysql database query, but it is not working and only shows me a blank page.
The download script :
<?ob_start();
$filename = $_REQUEST['arq'];
if(substr($filename,-3,3)=="php") {
$diretorio_download = $_REQUEST['diretorio_download'];
$file = $diretorio_download.$filename;
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Length: ' . filesize($file));
header('Content-Disposition: attachment; filename=' . basename($file));
readfile($file);
}
ob_end_flush();?>
My attempt to generate a download from a dinamic generated page
<?ob_start();
$filename = "http://www.thesite.com/thequerypage.php?id=$_REQUEST['id']";
$file = $filename;
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Length: ' . filesize($file));
header('Content-Disposition: attachment; filename=' . basename($file));
readfile($file);
ob_end_flush();?>
Is it possible ? must be saves as html ..
Thank´s in advance!!!
I have a forcing download script that work fine for images and pdf´s and doc´s.
It forces the download dialog box when clicking on the link.
Now i want to force the download of a dinamic page generated from a mysql database query, but it is not working and only shows me a blank page.
The download script :
<?ob_start();
$filename = $_REQUEST['arq'];
if(substr($filename,-3,3)=="php") {
$diretorio_download = $_REQUEST['diretorio_download'];
$file = $diretorio_download.$filename;
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Length: ' . filesize($file));
header('Content-Disposition: attachment; filename=' . basename($file));
readfile($file);
}
ob_end_flush();?>
My attempt to generate a download from a dinamic generated page
<?ob_start();
$filename = "http://www.thesite.com/thequerypage.php?id=$_REQUEST['id']";
$file = $filename;
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Length: ' . filesize($file));
header('Content-Disposition: attachment; filename=' . basename($file));
readfile($file);
ob_end_flush();?>
Is it possible ? must be saves as html ..
Thank´s in advance!!!