aspose file tools*
The moose likes Struts and the fly likes download and save a zip file from server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "download and save a zip file from server" Watch "download and save a zip file from server" New topic
Author

download and save a zip file from server

Udaya Raj
Greenhorn

Joined: Nov 01, 2002
Posts: 26
Hi,

I want to downlaod a zip file through the response of a Action class and save it in the client machine. How it can be done.

Regards

Uday


IBM Certified WebSphere 4.0 Specialist<br />IBM Certified in OOAD and UML
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The easiest way to do this is to create a link to the file. The browser will recognize that the file's suffix is not html, and will ask the user for a location to download it to.

for example:


you could also write a servlet that would read the file and send it as a byte stream, but why go to all that trouble, when a simple link will do the job?

Merrill


Merrill
Consultant, Sima Solutions
Eugene Lucash
Ranch Hand

Joined: Feb 19, 2005
Posts: 77
You can do simple forward to zip file (It's worked)
So doing this you can benefit of control
(File download can be selective) and you don't need to worry about
streams and buffering
[ February 24, 2005: Message edited by: Eugene Lucash ]
Sean Sullivan
Ranch Hand

Joined: Sep 09, 2001
Posts: 427
Originally posted by Udaya Raj:
I want to downlaod a zip file through the response of a Action class and save it in the client machine. How it can be done.


Use the ServletOutputStream. Here's an example:

http://strutsblobapp.sourceforge.net/xref/example/struts/FileDownloadAction.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: download and save a zip file from server