Re: file downloading problem
| From: | Nick Talbott | Date: | Wed, 18 Oct 2000 07:43:53 +0000 |
| Subject: | Re: file downloading problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-20820@lists.php.net to get a copy of this message | ||
Hi Jerry
>I'm trying to download a file that resides outside the web
>directory to a client.
>
>When the client initiates a download it incorrectly identifies the file by
>the name of the php script that is serving the file, this happens mostly
>on the macintosh, i.e. when someone trys to download say a mpg video,
>netscape will ask to save the file as "download.php" instead of
>"blah.mpg". I use this header to suggest a filename :
>
>Header("Content-Disposition: filename=$file_name");
>
>From what I understand, Content-Disposition isnt technically part of the
>http protocol, does that mean that some browsers like netscape might
>ignore it? Do browsers grab the filename from the end of uri? if so is
>there a way I can fake the browser out? any help would be greatly
>appreciated, ive been banging my head against the wall for a while on
>this one.
Couple of things to try. Are you also setting a MIME type for the download?
Add a header like ...
header("Content-Type: $mimeType");
... where $mimeType is an appropriate type.
Second, when using the Content-Disposition header you may find that some
browsers get the filename right right when there are quotes round the
filename, whereas others seem to get confused if there are quotes here. Not
had time to investigate this fully.
Regards
Nick Talbott
IT Policy and Strategy Manager, Powys County Council, UK
email nickt@powys.gov.uk
FAX +44 (0) 1597 824781
web http://www.powys.gov.uk and http://www.powysweb.co.uk