| Author |
How to send a Zip file to CLient
|
krishna sannidhi
Greenhorn
Joined: Jun 03, 2010
Posts: 1
|
|
i am getting the compressed (zipped) folder is invalid or corrupted on UI screen upon selecting the open button on dialog box. please help me out.......
HttpServletResponse response = HttpJSFUtil.getResponse();
File f = new File("C:\\Krishna\\AL3Files.zip");
OutputStream outputStream;
try {
outputStream = response.getOutputStream();
response.setContentType("application/zip");
response.setHeader("Content-Disposition","inline; filename=AL3Files.zip;");
byte[] arBytes = new byte[(int) f.length()];
FileInputStream is= new FileInputStream(f);
is.read(arBytes);
outputStream.write(arBytes);
outputStream.flush();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
|
 |
Devaka Cooray
Saloon Keeper
Joined: Jul 29, 2008
Posts: 2691
|
|
Hello Krishna, welcome to JavaRanch
Please UseRealWords instead of Invali, thi, pblm,.... and please UseCodeTags when you post a code.
Can you please click the button and make them changed?
|
Author of ExamLab (Download) - the free mock exam kit for SCJP / OCPJP
Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
|
 |
 |
|
|
subject: How to send a Zip file to CLient
|
|
|