How to force the user to download a file instead of opening it up in an
controlled environment within the browser (i.e. MS Word/Adobe Acrobat)

How to let a user download a picture by clicking on it instead of
needing to right click and Save-As.



Visit Today!!!
To see where PHP might take you tomorrow.

-----Original Message-----
From: Martin Thoma [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 3:20 PM
Subject: [PHP] Open Download-Box

Hello! I have a PDF-File, which the user should download (it should not
open in the browser, even if the Adobe-Reader-Pluging is installed). I

 $filename = $DOCUMENT_ROOT."/".$QUERY_STRING;
 $fd = fopen ($filename, "rb");
 $contents = fread ($fd, filesize ($filename));
 fclose ($fd);

 header("Content-type: application/octet-stream");

 echo $contents;

This doesn't work in IE (Version 6, 5 is not tested yet): When I get the
download-box and I choose "open" instead of "save", the download-box
opens again! Then pressing "open", everything is okay, but why is the
box opened twice?


PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to