Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14130

Re: Generating "download" pages

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Generating "download" pages
Date 2014-07-19 16:57 -0400
Organization A noiseless patient Spider
Message-ID <lqem3p$8m0$3@dont-email.me> (permalink)
References <6H9yv.30802$el1.16727@fx26.iad> <6732922.VsfUzaneRC@PointedEars.de> <%hwyv.9308$3Y7.9259@fx12.iad>

Show all headers | View raw


On 7/19/2014 11:38 AM, Lew Pitcher wrote:
> Thanks for the response, Thomas.
> 
> Next time, please contain your snark. It ill suits you.
> 
> On Friday 18 July 2014 11:39, in comp.lang.php, "Thomas 'PointedEars' Lahn"
> <PointedEars@web.de> wrote:
> 
>> Lew Pitcher 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.
>>>  
>>> The user selects (in this case) "Export recipes" (I'm developing a
>>> PHP/MySQL recipe management application), which causes
>>> 1) the page to change to a "Download in progress" page, and
>>> 2) a file (in this case, an XML file containing the recipes) to be sent
>>> to the client.
>>>
>>> Is this doable?
>>
>> Yes.  There are plenty of productive examples on the Web, for example when
>> you download from sourceforge.net and use the additional download link
>> (client-side scripting will trigger the download dialog automatically, but
>> you can cancel that)
> 
> I can, by viewing the source of web pages that use multiple javascript files
> with intentionally convoluted logic, and filtering out (in a masterly way)
> all that extraneous stuff, find that the web page in question (such as the
> download page for a sourceforge project) does *not* include the "server
> side" logic that does this. I can /then/ examine the headers from such a
> working page, *deduce* that the page sent both html
> and "Content-Disposition" (etc.) headers, and *assume* the method of
> generating such.
> 
> Indeed, this is how I've done it in the past, with poor results. 
> 
> 
>>> How do I do this with PHP?
>>
>> There are several ways.  Another is:
> 
> And, the first was?
> 
>>
>>   <?php
>>     header('Content-Disposition: attachment; filename="foo.bar"'); …
>>     header('Location: http://download.example/foo.bar');
>>   ?>
>>
>>   displayed content
>>
>> This not just a (PHP) language feature, it is using a language-independent
>> HTTP feature.
> 
> But, to set headers, you need some sort of active language. Mine is PHP.
>  
>> You can use browser developer tools to inspect the HTTP 
>> response headers, then use the corresponding PHP functions to achieve the
>> same.
> 
> Or, I can ask in a forum that specializes in such programming, and save
> myself the blind alleys, false starts, and mis-assumptions that such an
> inspection of the outside effects would bring
> 
> [snip suggested tools]
> 
> 
>>
>> Next time, do your homework, please.
> 
> Condescending, no?
> 
> In fact, I've done my homework. And *this* is part of that homework.
> 
> Thomas, either be helpful or don't reply. Such snark is not helpful.
> 

Lew,

Don't worry - Pointed Head is just being his usual pedantic self.  And
he's once again showing his ignorance, since you can't provide two
responses to one HTTP request (and can't send two different content
types for a single request).

For more info, please see my other updates.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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