Re: Generating "download" pages [message #186411 is a reply to message #186408] |
Sat, 19 July 2014 18:23 |
Lew Pitcher
Messages: 60 Registered: April 2013
Karma:
|
Member |
|
|
On Saturday 19 July 2014 13:43, in comp.lang.php, "Christoph M. Becker"
<cmbecker69(at)arcor(dot)de> wrote:
> Thomas 'PointedEars' Lahn wrote:
>
>>> On response to a trigger on one web page, I want to be able to generate
>>> and display a new web page, /and/ at the same time, send an associated
>>> file as a download.
>>>
>>> How do I do this with PHP?
>>
>> There are several ways. Another is:
>>
>> <?php
>> header('Content-Disposition: attachment; filename="foo.bar"'); …
>> header('Location: http://download.example/foo.bar');
>> ?>
>>
>> displayed content
>
> How is that supposed to work? HTTP can only deliver a single response,
> and AFAIK there is no such thing as multipart responses for HTTP.
That's what I suspected.
So, given that I'd like two things to happen (the web page to refresh /and/
a file to download) on one HTTP request (ideally, a POST), what sort of
processing do I need to do in PHP? Or, /can/ I do this at all? Obviously,
some web pages /do/ this sort of thing, so it must be possible, but /how/
they do it is the question I can't answer.
--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request
|
|
|