Possible Duplicate:
How to change the filename displayed in the “Save as…” dialog from .php to .png
My PHP-generated GUI displays a dynamically-generated PNG image:
<img src="someScript.php?dataId=xyz&width=250&height=200" alt="Chart" />
The image contents are dynamic and unique based on the dataId
argument:
<?php
header('Content-Type: image/png');
// output image based on $_GET['dataId']
?>
But when my users try to right-click and Save As in IE, Firefox or Chrome, the suggested filename is someScript.php.png
. This is non-unique and not very useful.
How can I "hint" to browsers as to what the "save as" filename should be?
Browsers can always do what they like, but the precedent set by HTTP's Content-Disposition: attachment; filename=<filename>
implies to me that there may be some way of hinting at a filename. This HTTP header itself is not appropriate because the I want the Content-Disposition
to remain at the default of inline
.