RE: [PHP] choosing the name to save a file as in a script
| From: | Erik J. Barzeski | Date: | Wed, 27 Dec 2000 15:52:40 +0000 |
| Subject: | RE: [PHP] choosing the name to save a file as in a script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31967@lists.php.net to get a copy of this message | ||
Hi,
You can always get the filename and set a META redirect after 0 seconds
and then it'll download as whatever file you specify in your script or
whatever.
Such as:
include("DATABASE_CONNECTION.inc");
$sql_query="select * from some_db where id='$id'";
$result=mysql_query($sql_query);
$the_row=mysql_fetch_array($result);
echo "<meta HTTP-EQUIV=\"refresh\" CONTENT=\"0;
URL=ftp://ftp.somesite.com/".$the_row['path_to_file']."\">";
php-general-digest-help@lists.php.net
<php-general-digest-help@lists.php.net> said something like this:
> By passing it in this way: script.php/filename.zip?id=123
> the browser will prompt to download the zip file with the name filename.zip
>
> If I pass it like that: script.php?file=filename.zip&id=123
> the browser will prompt to download script.php... Unless there's a header
> that can be sent to change the filename that the browser will save the file
> as? Haven't seen anything like that...
--
Best wishes,
Erik J. Barzeski
Life is a mistake. As with all mistakes, you
would be best advised to learn from it and make
the best of it - Lewis Carroll.
************************************************
Email: erik@barzeski.com
Web: http://www.barzeski.com/
http://www.soundsetcentral.com/
http://www.applescriptcentral.com/
AIM: iacas ICQ: 8186546
************************************************