Return-Path: X-Original-To: apmail-perl-modperl-archive@www.apache.org Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BA77C10457 for ; Tue, 30 Apr 2013 18:58:05 +0000 (UTC) Received: (qmail 53090 invoked by uid 500); 30 Apr 2013 18:58:04 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 53053 invoked by uid 500); 30 Apr 2013 18:58:04 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 53046 invoked by uid 99); 30 Apr 2013 18:58:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Apr 2013 18:58:04 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of cfaust@doyougot.com designates 208.79.232.125 as permitted sender) Received: from [208.79.232.125] (HELO postoffice.gristmillmedia.com) (208.79.232.125) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Apr 2013 18:57:58 +0000 Received: from c-98-217-219-254.hsd1.ma.comcast.net ([98.217.219.254]:55536 helo=AnalogWork) by postoffice.gristmillmedia.com with esmtpa (Exim 4.80) (envelope-from ) id 1UXFk9-000540-Fk; Tue, 30 Apr 2013 13:57:37 -0500 From: "Chris Faust" To: "'Jim Schueler'" Cc: References: <07ed01ce45c0$55d1e720$0175b560$@com> <082a01ce45ce$a8bbc2e0$fa3348a0$@com> In-Reply-To: Subject: RE: Download then display page Date: Tue, 30 Apr 2013 14:56:42 -0400 Message-ID: <084901ce45d4$748b90d0$5da2b270$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac5F0GWTU0qbcEYMSAGu3MsXZ9m08QAA//OQ Content-Language: en-us X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - postoffice.gristmillmedia.com X-AntiAbuse: Original Domain - perl.apache.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - doyougot.com X-Get-Message-Sender-Via: postoffice.gristmillmedia.com: authenticated_id: cfaust@doyougot.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Checked: Checked by ClamAV on apache.org Thanks Jim, I'm going to give that a try and see if I can get it to = work. -Chris -----Original Message----- From: Jim Schueler [mailto:jschueler@eloquency.com]=20 Sent: Tuesday, April 30, 2013 2:28 PM To: Chris Faust Cc: modperl@perl.apache.org Subject: RE: Download then display page Yes, that's what I have in mind. I only occassionally write headers.=20 But I envision something similar to what you've got below: $redirect =3D ... ; ## URL to the spreadsheet $r->content_type('text/html') ; $r->headers_out->set( Location =3D> $redirect ) ; $r->send_http_header ; $r->print( $content->output ) ; return Apache2::Const::REDIRECT ; Originally, I wondered about using a "multipart/mixed" response type.=20 I've never heard that any browser supports such a thing. Although that seems like a more elegant solution. -Jim On Tue, 30 Apr 2013, Chris Faust wrote: >>> But the response should be a redirect to a URL that returns the > spreadsheet instead of a 200 OK. I believe that the body of the=20 > original response will be displayed until the redirect succeeds. > > I'm not sure what I follow you, something like this? > > $r->content_type('text/html'); > print $content->output; > $r->headers_out->set(Location =3D> $redirect); return=20 > Apache2::Const::REDIRECT; > > And the $redirect URL would then do the sending of the file itself? > > Thanks! > > > -----Original Message----- > From: Jim Schueler [mailto:jschueler@eloquency.com] > Sent: Tuesday, April 30, 2013 1:53 PM > To: Chris Faust > Cc: modperl@perl.apache.org > Subject: Re: Download then display page > > I believe the following will work (never tried it though): > > The request should return a 'text/html' type document that displays=20 > the instructions. But the response should be a redirect to a URL that = > returns the spreadsheet instead of a 200 OK. I believe that the body=20 > of the original response will be displayed until the redirect = succeeds. > > In the old days, we performed this trick by using meta tag equivalents = > of the response headers. And I expect browsers will respond to actual = > HTTP headers the same way. I say "the old days" because for last 18=20 > years, I've relied on javascript. But there may be reasons for not=20 > wanting a different type solution. > > -Jim > > > > > On Tue, 30 Apr 2013, Chris Faust wrote: > >> >> Hi, >> >> =A0 >> >> I'm trying to have a form submission package up the results in a xls=20 >> file and then start the download for the user as well as present a=20 >> page where they can click on the file if the download has not already = >> automatically started. >> >> =A0 >> >> I can do each separately but not both together, I have something like > this: >> >> =A0 >> >> ... Make up our xls file download and put it in $output >> >> =A0 >> >> $r->content_type('application/xls'); >> >> $r->err_headers_out->add('Content-Disposition' =3D> 'attachment; filename=3D"' > . >> $download_name . '"'); >> >> $r->print($output); >> >> $content->param('set some html template vars....'); >> >> $r->content_type('text/html'); >> >> print $content->output; >> >> =A0 >> >> When I due the above, then I get prompted for the download but that=20 >> is it, I never get the page. Even if I reverse the order and try to=20 >> do the page >> first: >> >> =A0 >> >> $r->content_type('text/html'); >> >> print $content->output; >> >> $r->content_type('application/xls'); >> >> $r->err_headers_out->add('Content-Disposition' =3D> 'attachment; filename=3D"' > . >> $download_name . '"'); >> >> $r->print($output); >> >> $content->param('set some html template vars....'); >> >> =A0 >> >> That still doesn't work. Probably not a mod_perl specific question=20 >> but I'm hoping someone can shed some light >> >> =A0 >> >> TIA! >> >> -Chris >> >> =A0 >> >> =A0 >> >> >> > > >