Default filename in download dialog box
Posted: Mon Mar 01, 2010 12:22 pm
Hello,
I have written a script to download files, but once the dialog box to prompt the user for a filename pops up, it has a .html extension by default, regardless of what the original extension was. Although not a big deal, it is annoying and inconvenient, and I'd like to display the original filename by default. Any ideas?
The code I'm using is as follows. The user clicks on a download link that loads download.php.
Download.php:
-------------------------------------------------------------------------------------------
header('content-type=text/xml');
header('content-disposition: attachment;filename = Copyright.xml');
readfile('Copyright.xml');
--------------------------------------------------------------------------------------------
NOTE: There are no errors. The file is downloaded properly.
Thanks,
Jawad
I have written a script to download files, but once the dialog box to prompt the user for a filename pops up, it has a .html extension by default, regardless of what the original extension was. Although not a big deal, it is annoying and inconvenient, and I'd like to display the original filename by default. Any ideas?
The code I'm using is as follows. The user clicks on a download link that loads download.php.
Download.php:
-------------------------------------------------------------------------------------------
header('content-type=text/xml');
header('content-disposition: attachment;filename = Copyright.xml');
readfile('Copyright.xml');
--------------------------------------------------------------------------------------------
NOTE: There are no errors. The file is downloaded properly.
Thanks,
Jawad