This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes stop downloading the uploaded file on a event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "stop downloading the uploaded file on a event" Watch "stop downloading the uploaded file on a event" New topic
Author

stop downloading the uploaded file on a event

sai prasad tangirala
Greenhorn

Joined: Dec 05, 2007
Posts: 4
Hi,
We are uploading a file from JSP and there would be a "cancel" button. On click on "cancel" button we need to stop the process of reading the uploaded file i.e we should stop the process of reading the stream and writing the file on the disk. We are using apache commons fileupload for this. Some one kindly helps us on this.

Thanks,
Sai
Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 518
    
    2

In my personal opinion, I do not think, if it would be possible to stop that is under transmission to the server. Once you click upload, the process begins and clicking "cancel" at a later point, would be a different HTTP request and since HTTP is stateless, it would not know anything what happened earlier or what to stop. So I think it is not possible implicitly. But I would like to see, what experts have to say on this. Though I never tried before, your question made me to think, on those situations where I click "stop" on browser in the middle of some page loading. What kind of requests go to server and how does it handle "Stop".


Regards
KumarRaja

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

I think Kumar is right about that. Once the upload has started, there isn't any place to click "Cancel". Of course it's always possible for the user to abort the upload by some other brute force method, like for example closing the browser window or maybe clicking the Back button. However I too don't know what happens at that point. Perhaps you could do some experiments and see for yourself.

Or if you absolutely have to have a Cancel button, perhaps a file-upload applet would be a solution.
 
GeeCON Prague 2014
 
subject: stop downloading the uploaded file on a event