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


Groups > comp.lang.php > #14112

Re: Generating "download" pages

From Lew Pitcher <lew.pitcher@digitalfreehold.ca>
Subject Re: Generating "download" pages
Newsgroups comp.lang.php
References <6H9yv.30802$el1.16727@fx26.iad> <6732922.VsfUzaneRC@PointedEars.de>
Organization The Pitcher Digital Freehold
Message-ID <FAwyv.54231$4n.6402@fx31.iad> (permalink)
Date 2014-07-19 11:58 -0400

Show all headers | View raw


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.
>> 
[snip]
>> 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
[snip]

Now, having tried your suggested solution, I must tell you that *it did not
work*. So much for /your/ advice.

Here's the PHP I wrote:
 <?php
   header('Content-Disposition: attachment; filename="SixSpot_d.png');
   header('Location: http://merlin.puter.lan/~lpitcher/SixSpot_d.png');
 ?>
 <html>
 <head><title>Trial Sendfile</title></head>
 <body>
 <p>Did you get it?</p>
 </body>
 </html>

There exists, in the source directory, a PNG file named "SixSpot_d.png.
That file can be accessed through the (internal) url
http://merlin.puter.lan/~lpitcher/SixSpot_d.png'

The web page, above, fails to initiate a download or show the specified web
page.

Instead, the web browser (Firefox 5.0.1 for Linux) /displays/ the specified
PNG, instead of the specified html, and /does not/ initiate either an
automatic download into the configured download directory or the Download
menu itself.

Advice (from various sources including PHP.NET) conflict as to which headers
are required, and the order of steps to perform.

So, Thomas, got any more "advice" for me?
-- 
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request

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