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 Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem while downloading file from server

 
sreenath reddy
Ranch Hand
Posts: 415
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I have 2 frames in my jsp and the second frame has a file which is on the server and in the top frame i have download the file . On clicking this i go to server and i will flush the stream to the response by setting some headers .

Then a open/save dialog box comes up and after saving the file, nothing will work in my top frame as it says "Unspecified Error" at the client side (in javascript)

This is because the document is getting null after this .

can any one let me know what might be the problem .


Regards
Sreenath
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Out of curiosity, why do you have an entire frame devoted to downloading a file? I understand if it's a file that could be displayed within the frame, like a pdf or a movie for example, but if it's something that needs to be downloaded why not just have a link?

And as always the relevant samples of your code are always helpful.

-Yuriy
 
sreenath reddy
Ranch Hand
Posts: 415
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the bottom frame for showing the data in the file .if the user wants to download that

file (As its on the server ) we have this download option.

And coming to my top frame where there are few buttons

<a href="/export.do?id=test.html" class="two">Download</a> . When the user clicks download it goes to a servlet and sets the response headers as

1. response.setContentType("application/x-download");
2. response.setHeader("Content-Disposition", "attachment; filename=Report"+id+".zip");

and after open/save dilaog , i save this file .After this other functionalities in the same
page wont work and javascript error comes up on clicking saying "Unspecified error" .The reason is document object is not available for the frame .

But doing some research i got to know that there is some problem with the header 2 i am setting for the response .If i remove this everything works fine. but i cant remove that as the file name while saving will come as "export.do" for that file.

can any one tell me what might be the problem ?? r else is there any header substituting the header 2 so that i get appropriate file name
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic