Thanks it works.
Regards,
Partha

-----Original Message-----
From: Andrea Palermo [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 24, 2003 5:04 PM
To: [EMAIL PROTECTED]
Subject: Re: forcing netscape to download


I use this:

    response.setContentType ("application/octet-stream");
    response.setHeader ("Content-Disposition", "attachment;
filename=\""+nome_file+"\"");

    File f = new File
(serverPath+"natco\\areeriservate\\"+username+"\\"+titolo+"\\"+nome_file);
    InputStream in = new FileInputStream(f);
    ServletOutputStream outs = response.getOutputStream();
    int bit = 256;
    int i = 0;
    try {
        while ((bit) >= 0) {
            bit = in.read();
            outs.write(bit);
        }
    } catch (IOException ioe) {
            System.err.println("Err download");
    }
    outs.flush();
    outs.close();
    in.close();

I tried it in Netscape 6.2 and it seems to work properly

Bye

Andrea



>From: Partha Ranjan Das <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>         Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: forcing netscape to download
>Date: Fri, 24 Jan 2003 16:39:05 +0530
>
>Hi,
>
>I am having this following code that sets the header "Content-disposition"
>to "attachment;filename=temp_xyz.csv" that downloads the file to IE without
>opening it.
>but when I try to do the same in NS6 it opens the file in the browser
>window. Remember that this code is in the JSp file that is called by the
>download button in the previous page.
>
>String sfname="temp_xyz.csv";//File Name
>response.setHeader("Content-disposition","attachment;filename="+sfname);
>
>
>What can be done to download it in NS6 also?
>
>Thanks in advance,
>
>Regards,
>Partha Ranjan Das.
>
>
>*********************************************************************
>Disclaimer: The information in this e-mail and any attachments is
>confidential / privileged. It is intended solely for the addressee or
>addressees. If you are not the addressee indicated in this message, you may
>not copy or deliver this message to anyone. In such case, you should
>destroy
>this message and kindly notify the sender by reply email. Please advise
>immediately if you or your employer does not consent to Internet email for
>messages of this kind.
>*********************************************************************
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html


_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
*********************************************************************
Disclaimer: The information in this e-mail and any attachments is
confidential / privileged. It is intended solely for the addressee or
addressees. If you are not the addressee indicated in this message, you may
not copy or deliver this message to anyone. In such case, you should destroy
this message and kindly notify the sender by reply email. Please advise
immediately if you or your employer does not consent to Internet email for
messages of this kind.
*********************************************************************

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to