Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #14134
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Generating "download" pages |
| Date | 2014-07-20 01:04 +0200 |
| Message-ID | <53CAF981.809@arnowelzel.de> (permalink) |
| References | <6H9yv.30802$el1.16727@fx26.iad> <6732922.VsfUzaneRC@PointedEars.de> <lqeamt$jjv$1@solani.org> |
Christoph M. Becker, 2014-07-19 19:43:
> 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.
It will not work - the browser will likely follow the Location header
and just ignore the Content-Disposition.
> 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.
Yep - it's right, a Refresh header is not part of HTTP/1.1 - but most
browsers will still accept it (at least when using <meta
http-equiv="refresh" ...>) and behave as expected. As a fall back one
should offer a direct link within the displayed content anyway - since
client side scripting may also not work if the user did not enable it.
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
http://fahrradzukunft.de
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-18 09:55 -0400
Re: Generating "download" pages Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-18 17:39 +0200
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 11:38 -0400
Re: Generating "download" pages Jerry Stuckle <jstucklex@attglobal.net> - 2014-07-19 16:57 -0400
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 17:06 -0400
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 11:58 -0400
Re: Generating "download" pages Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-19 19:06 +0200
Re: Generating "download" pages "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-07-19 19:43 +0200
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 14:23 -0400
Re: Generating "download" pages "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-07-19 22:18 +0200
Re: Generating "download" pages "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-07-19 22:38 +0200
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 16:54 -0400
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 17:00 -0400
Resolved: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-20 14:34 -0400
Re: Generating "download" pages Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-19 20:50 +0200
Re: Generating "download" pages "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-07-19 22:06 +0200
Re: Generating "download" pages Jerry Stuckle <jstucklex@attglobal.net> - 2014-07-19 16:54 -0400
Re: Generating "download" pages Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-20 00:48 +0200
Re: Generating "download" pages Arno Welzel <usenet@arnowelzel.de> - 2014-07-20 01:04 +0200
Re: Generating "download" pages Arno Welzel <usenet@arnowelzel.de> - 2014-07-19 18:17 +0200
Re: Generating "download" pages Jerry Stuckle <jstucklex@attglobal.net> - 2014-07-19 16:55 -0400
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 12:25 -0400
Re: Generating "download" pages Tim Streater <timstreater@greenbee.net> - 2014-07-19 17:36 +0100
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 13:53 -0400
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 14:14 -0400
Re: Generating "download" pages Curtis Dyer <dyer85@gmail.com> - 2014-07-23 00:38 +0000
csiph-web