This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to send a Zip file to CLient

 
krishna sannidhi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
ExamLab Creator
Marshal
Pie
Posts: 4426
255
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic