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 64E9DF445 for ; Tue, 30 Apr 2013 18:16:38 +0000 (UTC) Received: (qmail 61447 invoked by uid 500); 30 Apr 2013 18:16:37 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 61422 invoked by uid 500); 30 Apr 2013 18:16:37 -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 61409 invoked by uid 99); 30 Apr 2013 18:16:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Apr 2013 18:16:37 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.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:16:29 +0000 Received: from c-98-217-219-254.hsd1.ma.comcast.net ([98.217.219.254]:54930 helo=AnalogWork) by postoffice.gristmillmedia.com with esmtpa (Exim 4.80) (envelope-from ) id 1UXF5z-0004EH-Sr; Tue, 30 Apr 2013 13:16:07 -0500 From: "Chris Faust" To: "'Jim Schueler'" Cc: References: <07ed01ce45c0$55d1e720$0175b560$@com> In-Reply-To: Subject: RE: Download then display page Date: Tue, 30 Apr 2013 14:15:12 -0400 Message-ID: <082a01ce45ce$a8bbc2e0$fa3348a0$@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: Ac5Fy6BGUwBixsiXRG+m6cboMO9X4gAAmc7w 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 >>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 = 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 Apache2::Const::REDIRECT; And the $redirect URL would then do the sending of the file itself? Thanks! =20 -----Original Message----- From: Jim Schueler [mailto:jschueler@eloquency.com]=20 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 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 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 years, = I've relied on javascript. But there may be reasons for not wanting a = different type solution. -Jim On Tue, 30 Apr 2013, Chris Faust wrote: >=20 > Hi, >=20 > =A0 >=20 > 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=20 > automatically started. >=20 > =A0 >=20 > I can do each separately but not both together, I have something like this: >=20 > =A0 >=20 > ... Make up our xls file download and put it in $output >=20 > =A0 >=20 > $r->content_type('application/xls'); >=20 > $r->err_headers_out->add('Content-Disposition' =3D> 'attachment; = filename=3D"' . > $download_name . '"'); >=20 > $r->print($output); >=20 > $content->param('set some html template vars....'); >=20 > $r->content_type('text/html'); >=20 > print $content->output; >=20 > =A0 >=20 > When I due the above, then I get prompted for the download but that is = > it, I never get the page. Even if I reverse the order and try to do=20 > the page > first: >=20 > =A0 >=20 > $r->content_type('text/html'); >=20 > print $content->output; >=20 > $r->content_type('application/xls'); >=20 > $r->err_headers_out->add('Content-Disposition' =3D> 'attachment; = filename=3D"' . > $download_name . '"'); >=20 > $r->print($output); >=20 > $content->param('set some html template vars....'); >=20 > =A0 >=20 > That still doesn't work. Probably not a mod_perl specific question but = > I'm hoping someone can shed some light >=20 > =A0 >=20 > TIA! >=20 > -Chris >=20 > =A0 >=20 > =A0 >=20 >=20 >