• Post Reply Bookmark Topic Watch Topic
  • New Topic

download file option  RSS feed

 
Abhishek Reddy
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any one suggest me how to give download option in the jsp page. Also tell me how to find out whether the user downloaded the file completely or not?

I have given the download option in the following way it is working fine, but iam unable to find out whether the user downloaded the file successfully or not..

<a href="path to download file">Download File</a>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no way to know when the download completes, or if it was downloaded at all.

If you stream the file through your own servlet, you can at least keep track over whether all the bytes were sent on their way or not, but that is the extent of what you can know.
[ September 12, 2007: Message edited by: Bear Bibeault ]
 
Abhishek Reddy
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok thanks for the reply..

If you stream the file through your own servlet, you can at least keep track over whether all the bytes were sent on their way or not, but that is the extent of what you can know.

Can you tell me how to keep track of the stream while downloading?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look that the Simple Stream application in our Code Barn:
http://www.javaranch.com/codebarn/codebarn-servlets-simplestream.jsp

Once you deploy it, find the source to StreamServlet.
In there you will see the loop that moves the bytes from the inputStream to the ServletOutput Stream.

You could easily add code that increments a long integer to that loop to count the number of bytes streamed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!