By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,044 Members | 1,291 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,044 IT Pros & Developers. It's quick & easy.

Outlook .vcs files, working in everything but IE 6

P: 3
I found a similiar topic on here, but it's different enough that I'm not quite able to figure out the problem I'm having here. Insert obligatory noob disclaimer.

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
  1. <?php
  2.  
  3. $val = $_GET['event'];
  4.  
  5. header("Content-Type: application/octet-stream");
  6. header("Content-Length: " . filesize("archives/$val.vcs"));
  7. header('Content-Disposition: attachment; filename="archives/$val.vcs"');
  8. readfile("archives/$val.vcs");
  9. ?>
  10.  
Please be gentle with me :)
May 18 '07 #1
Share this Question
Share on Google+
4 Replies


pbmods
Expert 5K+
P: 5,821
Heya watchedpots. Welcome to TSDN!

Try using 'application/force-download' as your Content-type.
May 18 '07 #2

P: 3
Thanks, good to be here.

Still having the same problem with force-download though. IE 6 downloads a file (with no extension) called "addcal" (addcal.php is the name of the script). The content of the file it downloads is actually the correct vcs data if i open it with notepad, but without that extention, the user's pc won't know to open it with Outlook.

Incidentally, when FF or IE 7 downloads the file, they name it $val.vcs, which is a litle weird but which i can live with because at least it's a vcs file and it has the right data.
May 21 '07 #3

pbmods
Expert 5K+
P: 5,821
Try adding this:

Expand|Select|Wrap|Line Numbers
  1. header('Content-disposition: attachment; filename=addcal.vcs' );
  2.  
So now we have:
Expand|Select|Wrap|Line Numbers
  1. header('Content-type: force-download');
  2. header('Content-disposition: attachment; filename=addcal.vcs' );
  3.  
May 21 '07 #4

P: 3
Wow, it worked! Thanks so much, I really appreciate it.

FYI, it works with application/octet-stream as the Content-Type, which I went back to because FF seemed to think it was dealing with an mp3 file with force-download.
May 23 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.