Link to home
Start Free TrialLog in
Avatar of catmanmike
catmanmike

asked on

IE 6 and Specifying MIME type from PHP

Hi All,

I have a PHP script that forces a file download of a file with a .2XA file extension.

This file is XML and contains info that is used by the 2X Application server client to display an application running on a terminal server onto the user's desktop w/o a remote dekstop.

The user clicks on a link and Excel or some other app appears running on their desktop.

I have a small PHP script that populates an XML: template with the info for the user and then forces a download to the user's client where the 2X client is called to handle the file association.

This works fine on IE 7.

However on IE 6, even with the open file by content setting disabled, it renames the file on the fly to .XML or .TXT and displays it in the browser.

This is what I am using for for Content Type:

Content-Type: application/octet-stream

Could this be the issue with IE 6? Does it want some other type of content-type?

If so what would I use? Is there a MIME type created when an application is installed on a PC?

Sorry if these are ignorant questions but I am new at this.

Thanks,

Mike

Avatar of Ionut A. Tudor
Ionut A. Tudor
Flag of Romania image

try with this header
header("Content-Type: application/force-download");
Avatar of catmanmike
catmanmike

ASKER

I tried what you suggested and again it works for IE 7 but with IE 6 it now removes the "Open" option in the dialog box and only allows a save.

Is it possible to create a mime type such as "application/2x" amd have that defined on the local PC to do the "right thing"?

Otherwise any other suggestions on mime type?

Thanks!

Mike
I suspect this to be a browser and type association extension problem but try with these headers:
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=\"myfile.xls\";" );
 If the above is not working try forcing download for a file with no extension, and tell your clients to open it with the respective program.
Cheers
Thanks I'll try that.

How can I check if it's a browser and file type association problem?

I've checked that the correct application is associated with assoc at the command prompt.

I've also saved the downloaded file and double clicked it and the 2x client does the correct thing.

Am I missing something?

Thanks!

Mike
ASKER CERTIFIED SOLUTION
Avatar of Ionut A. Tudor
Ionut A. Tudor
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I had checked with the IE folks and turned out it was something in IE6.

Thanks for your assistance.

Mike