FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Generating "download" pages
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Generating "download" pages [message #186408 is a reply to message #186400] Sat, 19 July 2014 17:43 Go to previous messageGo to previous message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma:
Senior Member
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.

Anyway, I have tried that idea, and that confirmed my presumption that
the browser is redirected to the Location URI, but the "displayed
content" is not shown.

Using a Refresh header instead of Location might work, but on one hand
the Refresh is not part of the HTTP/1.1 specification (CMIIW), and on
the other the effect is not exactly what the OP asked for. It seems to
me the only way to get this behavior would be in combination with client
side scripting, what would be on-topic for comp.lang.javascript, for
instance.

--
Christoph M. Becker
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Resolved: Generating "download" pages
Next Topic: Your opinion on which technologies to use when building web applications
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu May 09 23:09:26 GMT 2024

Total time taken to generate the page: 0.05125 seconds