The moose likes Servlets and the fly likes Download files from server to a zip file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Download files from server to a zip file" Watch "Download files from server to a zip file" New topic
Author

Download files from server to a zip file

christine clarin
Ranch Hand

Joined: Feb 05, 2005
Posts: 106
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

Joined: Dec 11, 2004
Posts: 13410

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?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
christine clarin
Ranch Hand

Joined: Feb 05, 2005
Posts: 106
hello, thanks! this helps a lot!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Download files from server to a zip file
 
Similar Threads
without creating ZIP file on server (hard disk) and give it to client (download)
Loading images from zip files
Another file sending question...
Download file from server, then delete it from server?
J2SDK - zip format for windows