• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Keeping count of downloaded file

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have written a servlet for downloading file from the webpage. This servlet updates the total number of downloads once the download is successfully completed. I am using outputstream of the response to write the data into. The problem is when I click the href link in the browser (Either firefox or ie) the browser displays a dialogbox asking me to either open the file using a program or to save in a location. But in the meantime the server is sending data to the client's system. So if the file size is small, say 2KB then the download is already finished till I press OK or Cancel in the dialogbox. Thus even if the client presses cancel button of the dialog box the servlet has incremented the number of downloads for the file, which is wrong.

Therefore I want that the download should start only when the user clicks on the OK button of the dialogbox.

Please help me out.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are not going to be able to change the browser's behavior.
 
Poop goes in a willow feeder. Wipe with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic