Ok, Like many here I wanted to force people on our Intranet do download documents instead of opening them. We got lots of PDF's, Word Docs, Excel sheets and Powerpoint presentations that people can download.
I've been searching this forum for the proper headers to send and found a lot of good posts. I use the code below which should work ..
$fsize = filesize($upload_path.$real_name);
header("Content-Type: application/octet-stream\r\n");
header("Content-length: $fsize\r\n");
header("Content-disposition-type: attachment\r\n");
header("Content-disposition: filename=$document_name");
$fp = fopen("$upload_path$real_name", "rb");
fpassthru($fp);
exit;
There's a bit of code above this that via and id get's the name for the document so we know which document to fetch.
The problem is this: it works on xls and ppt files. However - both word and pdf document still open up in the browser automatically.
Anyone see an error in the code above?
I use IE6.0.2600
Thanks in advance.
/Björn