Re: Headers and "save as" dialog box.
From: Pedro Graca (hexkid_at_hotpop.com)
Date: 03/31/04
- Next message: Kevin Thorpe: "Re: Simultaneous sessions ?"
- Previous message: Francisco: "Storing data for future visits"
- In reply to: Dariusz: "Headers and "save as" dialog box."
- Next in thread: Dariusz: "Re: Headers and "save as" dialog box."
- Reply: Dariusz: "Re: Headers and "save as" dialog box."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Mar 2004 15:23:57 GMT
Dariusz wrote:
> ...
> The information for file locations etc is pulled from a database. What I
> would like to do however is to be able to pull the filename from the
> database and insert it as the filename, ie:
>
> header('Content-Disposition: attachment; filename="$Name"');
Read the strings reference
http://www.php.net/manual/en/language.types.string.php
taking particular attention to what is and is not interpolated.
$name = 'Pedro';
$name2 = 'my name is ' . $name; // my name is Pedro
$name3 = 'my name is $name'; // my name is $name
$name4 = "my name is $name"; // my name is Pedro
$name5 = 'my name is "$name"'; // my name is "$name"
$name6 = "my name is '$name'"; // my name is 'Pedro'
> But when I try to execute this, the "save as" box asks to save the file
> $Name, and if I change the line to:
>
> header('Content-Disposition: attachment; filename=$Name');
try
header('Content-Disposition: attachment; filename="' . $Name . '"');
which will output something like
Content-Disposition: attachment; filename="test.scr"
No garanties this will work as you want on all browsers though :)
-- USENET would be a better place if everybody read: : mail address : http://www.catb.org/~esr/faqs/smart-questions.html : is valid for : http://www.netmeister.org/news/learn2quote2.html : "text/plain" : http://www.expita.com/nomime.html : to 10K bytes :
- Next message: Kevin Thorpe: "Re: Simultaneous sessions ?"
- Previous message: Francisco: "Storing data for future visits"
- In reply to: Dariusz: "Headers and "save as" dialog box."
- Next in thread: Dariusz: "Re: Headers and "save as" dialog box."
- Reply: Dariusz: "Re: Headers and "save as" dialog box."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|