[PHP] Re: Form to page force download

2006-04-21 Thread Rafael

Peter Lauri wrote:
[···]

1. Fill out a form on a web page
2. Lands on a thank you page and force a download of a pdf

Right now I solve this by outputting the thank you page and then using a
javascript to redirect to the download.php that consist of the following:

header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename=eguide.pdf');
readfile('http://www.thedomain.com/download/eguide.pdf'); 


Unfortunally it seams like some browsers blocks my javascript that redirects
to that address. If JavaScript is enabled, this works fine.

How would you solve this? Any method in PHP? I was hoping to be able to do
the thing that download.php does in the same file as the output of my thank
you page.


	So... why don't you do it that way?  I have a function similar to your 
code (for sending the file) and call it whenever I need it in the 
'main' page (no special page for download used)  You may want to try 
yourself

--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
http://www.innox.com.mx

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: Form to page force download

2006-04-21 Thread Peter Lauri
Yes I am using that for the moment. The problem is that for the moment I
require javascript to make it work. And I know there are browsers that block
javascript, my client has already had a customer complaining that the
download did not start. Temporary I solved it by puttning a link it the
download does not start within a few seconds, please click here.

/Peter

-Original Message-
From: Rafael [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 21, 2006 9:22 PM
To: php-general@lists.php.net
Subject: [PHP] Re: Form to page force download

Peter Lauri wrote:
[···]
 1. Fill out a form on a web page
 2. Lands on a thank you page and force a download of a pdf
 
 Right now I solve this by outputting the thank you page and then using a
 javascript to redirect to the download.php that consist of the following:
 
 header('Content-type: application/pdf');
 header('Content-Disposition: attachment; filename=eguide.pdf');
 readfile('http://www.thedomain.com/download/eguide.pdf'); 
 
 Unfortunally it seams like some browsers blocks my javascript that
redirects
 to that address. If JavaScript is enabled, this works fine.
 
 How would you solve this? Any method in PHP? I was hoping to be able to do
 the thing that download.php does in the same file as the output of my
thank
 you page.

So... why don't you do it that way?  I have a function similar to
your 
code (for sending the file) and call it whenever I need it in the 
'main' page (no special page for download used)  You may want to try 
yourself
-- 
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
http://www.innox.com.mx

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php