views:

144

answers:

3

A webapp I've been developing allows users to upload and download a type of file which is meant to be treated as an opaque blob. My app serves it up with a file extension not commonly used for any other purpose, as well as specifying that its MIME Content-Type is application/octet-stream.

Internally, the file is a simple Zip archive containing a single compressed file. What I've found is that IE6 apparently inspects the content of the file, determines that it's a Zip archive, and "helpfully" saves it with an additional ".zip" extension. Unbelievable!

As I mentioned, this file is meant to be opaque, and we don't want users to be poking around inside the file--not because it's dangerous or contains sensitive information or anything, we just don't want to confuse them. I suggested prepending the Zip content with a magic number to prevent IE6 from recognizing it, but my manager says he'd prefer it if the file content could remain unchanged, so that knowledgeable people can rename the file and examine its contents as a zip archive, if necessary.

Is there any way to tell IE6 to keep its mitts off of the file? Or any alternative approach at all? (Alas, just not supporting IE6 at all is not an option.)

Incidentally, IE7 respects the file's name, but still identifies it as a Zip archive in the download dialog. That's better than IE6, but still less than ideal.

+1  A: 

use this header flag: Content-Disposition: attachment; filename="yourfilename.extension"

roman
I'm already doing that. I thought it was implicit in the fact that IE6 was corrupting my filename, which can only be supplied in that manner.
Sean
+1  A: 

This is a known problem, and the only solution is to edit the client computer's registry, which I'm sure doesn't help you a lot.

jball
I was able to solve a similar issue without the need to change the clients machine. See my answer.
Byran
Good to hear there's a solution!
jball
+4  A: 

Short answer: Add correct MIME types to you web server so IE6 doesn't guess the file type.

Long Answer:

My work had a similar problem with Microsoft PowerPoint files.

.ppt vs .pps - Which are identical files with different extensions. We wanted the user to view a show (.pps) but IE6 kept changing it to .ppt. It changed the extention because the users machine had PowerPoint installed and understood that the file "looked" like a . ppt. Don't understand why not .pps.

The problem, besides IE6, was that our web server (IIS) was not aware of either MIME types for .pps or .ppt. So we had to add the correct MIME types so the server would not deliver them as "application/octet-stream". I understand that by using "application/octet-stream" IE6 will try to guess the MIME type.

So we added:

.pps = "application/vnd.ms-powerpoint"
.ppt = "application/vnd.ms-powerpoint"

Now it works fine with IE6.

I hope this helps solve your problem.

Byran
Wow, thanks! I changed the MIME type to "application/x-mycompany-ourfiletype" and IE6 is behaving.
Sean