I want to implement download feature with zip archive file.
but the code below won't work.
Can you help me?
<%@ page import="java.util.zip.ZipOutputStream" %>
<%
ZipOutputStream zos = request.getAttribute("zip_output_stream");
String file_name = (String)request.getAttribute("file_name");
String strClient=request.getHeader("User-Agent");
if(strClient.indexOf("MSIE 5.5") != -1) {
response.setContentType("application");
response.setHeader("Content-Disposition", "attachment;filename=" + file_name + ";");
} else {
response.setContentType("Content-type: application/octet-stream;");
response.setHeader("Content-Disposition", "attachment;filename=" + file_name + ";");
}
if (zos != null){
/*
byte [] b = xml_value.getBytes();
BufferedOutputStream outs = new BufferedOutputStream(response.getOutputStream());
outs.write(b, 0, b.length);
*/
zos.write();
zos.close();
/*
outs.flush();
outs.close();
*/
}
%>