Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Content-Disposition and filename's with spaces 1

Status
Not open for further replies.

BlindPete

Programmer
Jul 5, 2000
711
US
ok here is the line in questions

Code:
header( "Content-Disposition: attachment; filename=$filename;");

the problem is that the page is dymanic and often times the $filename has spaces in it for example:

Code:
$filename="My File.txt"

the save dialog box comes up with "My" for a file name. the customer wants the spaces preserved else I'd just swap them for an underscore.

any ideas?


-Pete
Do you get a little guilty pleasure when a celebrity has a bad day?
Well then The Dead Pool is for you!
 
got it!
Code:
header( 'Content-Disposition: attachment; filename="'.$filename.'";');

doh!

-Pete
Do you get a little guilty pleasure when a celebrity has a bad day?
Well then The Dead Pool is for you!
 
hi, i was wondering, how do you get that to bring up the dialog box for save? cause i tryed it and cant get it to work!!

is there anything on a website that can help?

Martin

Computing help and info:

 
There's two steps to getting the save dialog box to open.

One is to use the "Content-disposition" header described above.

The second part is to set the "Content-Type" header to some value that your browser doesn't know what to do with. This should force your browser to open the "save" dialog.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top