Page 1 of 1

set name for generated page

Posted: Fri Mar 24, 2006 12:25 am
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

Posted: Fri Mar 24, 2006 12:39 am
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