File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple file download

 
lakshmi ananthamurthy
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to know if there is any way that we can do a multiple file download using servlets, NOT using Client pull (cause we cannot use Javascript), and save the files as separate files and not as a single file, and all this in one single connection..
the user should not have to keep chosing the file which he wishes to download.
I tried setting the mime type and working that out, but it seems to be giving problems.
 
manav kher
Ranch Hand
Posts: 98
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
let me know if u figure that out..we have a similar situation and as faras i know that would pop up the file-save/open input box multiple times
-manav
 
Phil Hanna
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you expect to do this without user intervention? There is always a prompt in the browser for where to save the file, because the user complete control over this. You can't dictate where they place files on their machine.
Have you thought of sending a .zip file? That way it could have a collection of files.
------------------
Phil Hanna
Sun Certified Programmer for the Java 2 Platform
Author of :
JSP: The Complete Reference
Instant Java Servlets
Website: http://www.philhanna.com
 
lakshmi ananthamurthy
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The requirement of the client is that he does not mind if the pop ups keep coming whether or not you wish to save the file or open it, but the user should not have to keep browsing and chosing the file to download.
 
arul narayan
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I also have a similar requirement. Can someone suggest ways to do this.
I also do not mind using javascript to do this. Using javascript, I am able to download only one file at a time, but I need to download multiple files selected by the user by checking check boxes and clicking a button.
Please suggest ways to download multiple files.
Thanks.
 
Vlad Patryshev
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys, if I understand the problem correctly, javascript cannot help. It is downloading files to the client machine without the user's initiative. It is kind of against security. You can do it in applets, though, but there ought to be some security settings permitting a specific applet to do so. Javascript will not download files.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After having a think about it, it should be possible, but if you try this on me I'll come after you... I'd only try this if the client is EXPECTING multiple files.
In the HTML returned to the client, have javascript that opens multiple new windows and have the target for each of these windows as the file you want the client to download.
eg (pseudocode)
<javascript>
window.open("http://location/file1.doc");
window.open("http://location/file2.mp3");
window.open("http://location/file3.xls");
//etc etc
</javascript>
Dave.
 
Cameron Park
Ranch Hand
Posts: 371
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you open a URLConnection and create files in the client drive?
 
arul narayan
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot David,
I followed your suggestion and it worked fine exactly the way I wanted. The windows get closed as soon as the download is complete which is fine. Ideally though, it would have been better if there is only one pop up box to download all the files.
The alternate working solution that I had was using a signed applet to do the downloads sequentially once the user selected the files and hit the download button. This had only one applet window open to do all the downloads. But the client did not want to do anything with applets and certificates.
Hence the javascript route is fine.
Thanks again for all the responses.
 
Susan Atmaja
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to accomplish this without using javascript?
i.e. Just using simple html code. I believe it would involve setting of the http header. Please advise. Thanks.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic