RE: [PHP] set filename of file open/download
| From: | David Buerer | Date: | Fri, 23 Aug 2002 15:24:56 +0000 |
| Subject: | RE: [PHP] set filename of file open/download | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-113798@lists.php.net to get a copy of this message | ||
Thanks Daniel,
That's what I use when I want to force the download. But what if I just
want to force the file to open?
That's when I do it the other way which works great for many file types like
PDF's. The problem is that some O/S's force an Open/Save dialog anyway and
the text it gives is this....
"You are downloading the file: dockit_getdoc.doc from
www2.josiahministries.com Would you like to open the file or save it to
your computer?"
I need to find a way to change 'dockit_getdoc.doc' to [filename].doc by
sending the appropriate header. I just don't know what that header is.
Thanks all for your considerd response.
-----Original Message-----
From: Daniel Masson [mailto:dmasson@imagine.com.co]
Sent: Friday, August 23, 2002 8:36 AM
To: php-general@lists.php.net
Subject: RE: [PHP] set filename of file open/download
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?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php