learn java
The moose likes Servlets and the fly likes How to send a Zip file to CLient Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to send a Zip file to CLient " Watch "How to send a Zip file to CLient " New topic

How to send a Zip file to CLient

krishna sannidhi

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.setHeader("Content-Disposition","inline; filename=AL3Files.zip;");

byte[] arBytes = new byte[(int) f.length()];
FileInputStream is= new FileInputStream(f);

} catch (IOException e) {
// TODO Auto-generated catch block
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3389

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 ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
subject: How to send a Zip file to CLient