I want to be able to add a "click to add to your Outlook Calendar" link to some pages for my company's site. I'm uploading .vcs files created in Outlook, and using some PHP (below) in an attempt to make it as intuitive as possible for end users.
It works in Firefox 1.5 and 2.0, in IE 7, and in Safari. But IE 6 will have absolutely none of it. It downloads the correct data, but as the .php file, opening it in the IE window as text instead of as an Outlook Calendar file like I want. I've been googling MIME types for an hour and trying every one I can find, with no success.
Please help me make IE 6 behave.
code:
Expand|Select|Wrap|Line Numbers
- <?php
- $val = $_GET['event'];
- header("Content-Type: application/octet-stream");
- header("Content-Length: " . filesize("archives/$val.vcs"));
- header('Content-Disposition: attachment; filename="archives/$val.vcs"');
- readfile("archives/$val.vcs");
- ?>