Re: Make fil downloadable
| From: | Stephen | Date: | Sat, 11 Jan 2003 01:01:22 +0000 |
| Subject: | Re: Make fil downloadable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131214@lists.php.net to get a copy of this message | ||
Would this print the contents or the actual file for download?
----- Original Message -----
From: "Timothy Hitchens (HiTCHO)" <phplists@hitcho.com.au>
To: "'Stephen'" <webmaster@melchior.us>
Cc: "'PHP List'" <php-general@lists.php.net>
Sent: Friday, January 10, 2003 7:47 PM
Subject: RE: [PHP] Make fil downloadable
: eg:
:
: <a href="file.php">Download File Click Here</a>
:
: Now in the file.php you have:
:
: <?php
:
: header("Content-type: text/plain");
: header("Content-Disposition: attachment; filename=xxx.php");;
: // now we read the real file
: readfile('xxx.php');
:
: exit();
:
: ?>
:
: This won't put the headers into the downloaded file and remember to
: change the xxx.php into the file
: to be delivered and the xxx.php in the header to the name you would like
: them to save as.
:
: * the file.php in the top is not the real file but a script that reads
: into the buffer the real file!!
:
:
:
: Timothy Hitchens (HiTCHO)
: Open Platform Consulting
: e-mail: tim@hitcho.com.au
:
: > -----Original Message-----
: > From: Stephen [mailto:webmaster@melchior.us]
: > Sent: Saturday, 11 January 2003 10:29 AM
: > To: Timothy Hitchens (HiTCHO)
: > Cc: PHP List
: > Subject: Re: [PHP] Make fil downloadable
: >
: >
: > It's a dynamically created file the user downloads and uses
: > later as a PHP script. If I put header() in it, that would
: > make it downloadable again when the user uses it on his/her
: > server, wouldn't it?
: >
: >
: > ----- Original Message -----
: > From: "Timothy Hitchens (HiTCHO)" <phplists@hitcho.com.au>
: > To: "'Stephen'" <webmaster@melchior.us>; "'PHP
List'"
: > <php-general@lists.php.net>
: > Sent: Friday, January 10, 2003 7:24 PM
: > Subject: RE: [PHP] Make fil downloadable
: >
: >
: > : You need to send headers to tell the browser how to handle it see:
: > : header(); or.. if it is a php file and you want the visitor to
: > : see/download the source you would be better off giving it another
: > : extension eg .phps or .txt etc or have a handler file that did a
: > : readfile after sending headers.
: > :
: > :
: > : Timothy Hitchens (HiTCHO)
: > : Open Platform Consulting
: > : e-mail: tim@hitcho.com.au
: > :
: > :
: > : -----Original Message-----
: > : From: Stephen [mailto:webmaster@melchior.us]
: > : Sent: Saturday, 11 January 2003 10:17 AM
: > : To: PHP List
: > : Subject: [PHP] Make fil downloadable
: > :
: > :
: > : I need to somehow make it so when a user clicks a link, then get
: > : displayed the download dialogue for the file. The file is a
: > .php file so
: > : I'm not sure how this is done but I've seen it been done
: > before. How can
: > : you do this?
: > :
: > : Thanks,
: > : Stephen Craton
: > : http://www.melchior.us
: > :
: > : "What's the point in appearance if your true love, doesn't
: > care about
: > : it?" -- http://www.melchior.us
: > :
: > :
: > : --
: > : PHP General Mailing List (http://www.php.net/)
: > : To unsubscribe, visit: http://www.php.net/unsub.php
: > :
: > :
: > :
: >
: >
:
:
: