RE: [PHP] set filename of file open/download
| From: | Daniel Masson | Date: | Fri, 23 Aug 2002 15:35:38 +0000 |
| Subject: | RE: [PHP] set filename of file open/download | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-113792@lists.php.net to get a copy of this message | ||
Hi ... !! Use this !!
//force download dialog
header("Content-type: application/octet-stream\n");
header("Content-disposition: attachment; filename=\"$arc\"\n");
$arc must contain the name of yhe file you want to be saved in the
client machine !
I'm using a php script to stream a microsoft word file to a browser.
I'm sending header("Content-type: {$mimetype[DOC]} \n"); to set the mime
type to application/msword so that the browser knows how to open the
file.
However, some users systems are configured to allow the choice of open
or saveas. The problem is that when the user selects saveas the
filename it uses is the name of the php script which streams the file,
not the actual filename of the file. How do I set this filename?