Re: Problem forcing a download
| From: | shaun | Date: | Mon, 05 May 2003 21:09:23 +0000 |
| Subject: | Re: Problem forcing a download | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146452@lists.php.net to get a copy of this message | ||
problem sorted,
thanks Jennifer
"Jennifer Goodie" <goodie@apollointeractive.com> wrote in message
news:NEBBIJJIKBGCCCNKMPBCGEEGHGAA.goodie@apollointeractive.com...
> Is the rest of the code in the page in an else{}? Other wise your page is
> going to continue down. Have you tried putting an exit() in after the
> readfile?
>
> > //view document
> > if(isset($_GET[view_document]) == true){
> > Header('Content-Type: application/octet-stream');
> > Header('Content-disposition: attachment;
filename='.$_GET['file_name']);
> > readfile('files/'.$_GET['file_name']);
> > }
> >
> > but it seems to be downloading the contents of test.txt followed
> > by the code
> > for view_document.php, any ideas why this is happening?
> >
> > Here is the link I call with:
> >
> > echo '<p>Click <a
> > href="view_document.php?file_name='.$file_name.'&file_id='.$file_i
> > d.'&projec
> >
> > t_name='.$_GET[project_name].'&project_id='.$_GET[project_id].'&vi
> > ew_documen
> > t=true">here</a> to download the document</p>';
> >
> > Thanks again.
>