The_AlienCoder
The_AlienCoder

Reputation: 577

I'm using the correct content type & Headers so Why is FireFox saving Zip Files without extensions

Users on my site have the option to download all the photos in an album as a zip file.The Zip file is dynamically created and saved to Response.OutPutStream to be detected as a file download on the user's browser.

Here is the Header and Content-type I am outputing

context.Response.AddHeader("Content-Disposition", "attachment; filename=Photos.zip");
context.Response.ContentType = "application/x-zip-compressed";

..Well everything works fine with every browser except FireFox. Although Firefox correctly detects the download as a Zip file, It saves the file without the .zip extension. I thought adding this header

context.Response.AddHeader("Content-Disposition", "attachment; filename=Photos.zip");

..is supposed to force FF to save the extension. I believe I am following the correct protocol so why is FF behaving this way and how do I fix this?

Upvotes: 3

Views: 1768

Answers (2)

cdm9002
cdm9002

Reputation: 1960

Put quotes around the name:

context.Response.AddHeader("Content-Disposition", "attachment; filename=\"Photos.zip\"");

Upvotes: 9

vaitrafra
vaitrafra

Reputation: 662

this may sount stupid, but are you shure the machine you are testing on have the option "hide common file extension" set to false?

Upvotes: 0

Related Questions