Problem forcing a download
| From: | shaun | Date: | Mon, 05 May 2003 18:46:49 +0000 |
| Subject: | Problem forcing a download | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146442@lists.php.net to get a copy of this message | ||
Hi,
I am trying to force licks to files to open a file save dialog box, whatever
the file type is.
I have the following link on my page (the page links back to itself):
<p>Click <a
href="view_document.php?file_name='.$file_name.'&view_document=true">here</a
> to download the document</p>';
I also include a file at the top of each page (top.php) for function calls
and in this file I have the following:
//view document
if(isset($_GET[view_document]) == true){
Header('Content-Type: application/octet-stream');
Header('Content-disposition: attachment; filename='.$_GET[file_name]);
}
when I click on the link I get the dialog box popping up but it downloads
the code for view_document.php.
I am obviously doing something silly here but I can't work it out, I would
be very grateful for you advice here.