Re: Form to page force download
| From: | Rafael | Date: | Fri, 21 Apr 2006 14:21:37 +0000 |
| Subject: | Re: Form to page force download | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234491@lists.php.net to get a copy of this message | ||
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