• Post Reply Bookmark Topic Watch Topic
  • New Topic

Download files from server to a zip file

 
christine clarin
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day, I'm not sure where I should put this question in the forums here, but i'm assuming this is the best place for it.

I just want to ask, if anyone could give me a snippet of java servlet code which would allow me to have a "batch download" i.e., i have several jpegs storedin my server, i have a jsp page which shows all of these with checkboxes on them, i want to check all the images i want to download and when i click on download, i will be asked to download a zip file containing these images. would that be possible?

i really need all the help i could get for this problem - i'm super lost! thanks a lot!

chris
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This forum is OK for this.

I'll give you some hints to get you started.
Look at the java.util.zip package for classes, provided by the Java API, that you can use for creating Zip files.
http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/package-frame.html

There is a project on my site that shows how to stream files from the server to the browser.
http://simple.souther.us Look for SimpleStream.
In this project, I'm reading the files from disc using getResourceAsStream but in your case, you should be able to stream the zip file right to the servletOutputStream.

Does this help?
 
christine clarin
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello, thanks! this helps a lot!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!