Reputation: 19352
I am writing a servlet that dynamically creates a zip file from some input streams and opens a "Save As" dialogue for download / store.
Although when using Chrome the file is indeed recognized as a valid zip file, its type remains unknown
when accessing it through Firefox
.
response.setContentType("application/x-zip-compressed");
response.setHeader("Content-Disposition", "attachment; filename=\"" + "TestName.zip" + "\"");
I have also used application/zip
for the content type with no luck whatsoever.
Any suggestions?
Upvotes: 1
Views: 485
Reputation: 19352
It turns out that the problem had to do with me closing and flushing the server output stream before setting Headers and Content type as in the question code sample. The fact that Chrome was nonetheless interpreting the file type correctly, confused me a bit.
Upvotes: 1