dwain wrote:
On 10/16/07, Kit Grose <[EMAIL PROTECTED]> wrote:
I'd think (as a user) if you use the terminology 'download' for the
link, the PDF should be sent with a force-download Content-type
header if possible (so it doesn't try to view it).
how would you code this force download?
dwain
This is what I use:
$type = $_GET['type'];
$fileName = $_GET['filename'] . "." . $type;
$mimeType = "application/$type";
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5') or
strpos($_SERVER['HTTP_USER_AGENT'], 'Opera 7')) $mimeType =
'application/x-download';
header("content-disposition: attachment; filename = \"$fileName\"");
header("content-type: {$mimeType}");
readfile($fileName);
where the link would be download.php?filename=mypdf&type=pdf
Kind Regards
--
Chris Price
Choctaw
[EMAIL PROTECTED]
http://www.choctaw.co.uk
Tel. 01524 825 245
Mob. 0777 451 4488
Beauty is in the Eye of the Beholder
while Excellence is in the Hand of the Professional
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-+- Sent on behalf of Choctaw Media Ltd -+-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Choctaw Media Limited is a company
registered in England and Wales
with company number 04627649
Registered Office:
Lonsdale Partners,
Priory Close,
St Mary's Gate,
Lancaster LA1 1XB
United Kingdom
*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************