Re: php redirection question
- From: Andy Jacobs <andy@xxxxxxxxxxxxxxx>
- Date: Thu, 19 Jan 2006 17:11:44 +0000 (UTC)
On 19/1/06 4:33 pm, in article ZbrfGOVc97zDFAN4@xxxxxxxxxxxxxxxxxxxx, "John
Lowe" <jrnl@xxxxxxxxxxxxxx> wrote:
> In message <jxTwf.25738$W4.1168@xxxxxxxxxxxxxxxxxxxx>, Gazza
> <news@xxxxxxxxxxxxxxxxxxxxxxx> writes
>>
>>
>> John Lowe mumbled the following on 07/01/2006 09:10:
>>
>>> Most of it is working. I send an email to the user containing a url with
>>> a code for delivery of the file containing the photograph, something
>>> like this:
>>
>>> <http://www.example.com/download.php?pic=AAA-0001-00&code=AAABBBCCCDDDE>
>>> The file gets delivered OK, but I want then to go to a page to say
>>> that
>>> things have worked, but nothing happens - the browser continues to show
>>> whatever page it was on when the above url was invoked. My code is
>>> something like this:
>>>
>>> -----------------------------------------------------------------------
>>> <?php
>>> /* various functions snipped, needed to get the following to work */
>>> function download_pic() {
>>> /* at this point I verify the returned data, check the code
>>> and generate the filename */
>>> header("Pragma: public");
>>> header("Expires: 0");
>>> header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
>>> header("Cache-Control: private", false);
>>> header("Content-Type: image/jpg");
>>> header("Content-Disposition: attachment;
>>> filename=\"".basename($filename)."\";");
>>> header("Content-Transfer-Encoding: binary");
>>> header("Content-Length: ".filesize($filename));
>>> readfile_chunked("$filename") or die("File not found.");
> /* remove next three lines */
>>> session_write_close();
>>> header("Location: http://www.example.com/taskcomplete.htm:);
>>> exit();
> /* up to here */
>>> }
>>> if(isset($_GET['code'])) download_pic();
>>> ?>
> /* and add in contents of taskcomplete.htm */
>>
>> Instead of trying to send the user to a seperate page, why not just put
>> the contents of taskcomplete.htm onto this page that has download_pic()
>> on it?
>>
>> The user clicks the link in the email, arrives at this page, the
>> function attempts to force the download of the pic, he saves to his
>> desktop, then the rest of the page loads, showing the "Thank you for
>> your custom". You may also like to include a fallback such as "If the
>> picture didn't download, please click here..."
>>
> I made the changes I have indicated above and got exactly the same
> result - no display of the html for taskcomplete - no change of what the
> browser is displaying at all. (The file downloads OK.) I must still be
> doing something wrong.
>
> Any suggestions?
Sorry if I'm missing the point but I've just seen this thread. It might
sound obvious, but have you tried just doing a simple redirect? Just
sticking a redirect in a page on it's own and then calling it through the
browser. The other thing, and it might just be a typo is that you seem to
have a " missing in your redirect line (Might be my Mac not displaying the
right character):
header("Location: http://www.example.com/taskcomplete.htm:);
Andy
.
- References:
- php redirection question
- From: John Lowe
- Re: php redirection question
- From: Gazza
- Re: php redirection question
- From: John Lowe
- php redirection question
- Prev by Date: Re: php redirection question
- Next by Date: Re: Ebay say Firefox is not "robust" enough
- Previous by thread: Re: php redirection question
- Next by thread: Re: php redirection question
- Index(es):
Relevant Pages
|