Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 882
The_AlienCoder Avatar asked Jan 28 '26 08:01

The_AlienCoder


1 Answers

Put quotes around the name:

context.Response.AddHeader("Content-Disposition", "attachment; filename=\"Photos.zip\"");
like image 154
cdm9002 Avatar answered Jan 30 '26 20:01

cdm9002