set name for generated page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
smichea
Forum Newbie
Posts: 1
Joined: Thu Mar 23, 2006 11:23 pm

set name for generated page

Post by smichea »

I have a php page which generate a php file that the user can save on his hard drive.
I used

Code: Select all

header('Content-Type: application/x-httpd-php');
to set the content type and its fine.
Now I would like to set the default name proposed by the browser when saving the file.
Without doing anything it is the name of my script, but I would like to change it.

Anyone know how to do this ?

Many thanks,
Sebastien
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the Content-disposition header is what you are after. Specifically, a property of it. An example of one of these headers can be found here: viewtopic.php?p=249325#249325
Post Reply