W3C home > Mailing lists > Public > www-jigsaw@w3.org > May to June 2001

Re: download file IE error

From: Eddy <pai990_2000@yahoo.com>
Date: Tue, 8 May 2001 14:10:31 -0400 (EDT)
Message-ID: <003601c0d7ea$04e6d650$7f10a8c0@matrox.com>
To: <www-jigsaw@w3.org>
Hello Buddy
  I am writing a program for downloading file by using servlet. I have
encounted a problem.  I set the response.setHead() in the program. Also
 I use the response.getOutputStream() from writing file. When I click the
 "start download" button, a popup window occurs. In the window, user got two
options(open or save). If user click ok for save, the second popup window
occurs. It asks user to choose the directory. But, when I click the "Cancel"
or "X" on the top of the window. The downloading file is locked in my
computer. I can not do anything for the file. I thought because I did not
close the outputstream. But, in my program, I do use the catch(Throwable
e).But, I still can not catch it.
 Do you have any ideas about that. I will be appreicated it


try {
    int size = 0;
    resp.setHeader("Content-Disposition", "attachment; filename=\""
+_file.getName()+ "\";");
    response.setHeader("Content-length", (new Long(fileSize)).toString());
    response.setHeader("Cache-Control", "no-cache");

    ServletOutputStream stream = response.getOutputStream();
    java.io.File target = new java.io.File(fileName);
    BufferedInputStream fif = new BufferedInputStream(new
    int data;
    int downloadedSize = 0;
    int downloadSeccess = 1;

     while((data = fif.read()) != -1) {

    catch(Throwable e){

Thanks a lot

Received on Wednesday, 9 May 2001 07:19:28 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:37 UTC