Hello,

I am facing a problem dowloading a file from servlet. Everything work well, except 
that the dialog box (asking saving or open file) popup twice when I choose to open 
file option. Saving is ok, the dialog box open only 1. Any body have the idea to 
suggest me?

Thanks

Myo


file = new File(CDRpath);
                if ( ( content_type = request.getParameter ("CONTENT_TYPE")) == null)
                        content_type = "application/octect-stream";
                response.setContentType (content_type);
                response.setHeader ("Content-Disposition", "attachment; filename=\"" + 
file.getName () + "\"");
                ServletOutputStream out = response.getOutputStream ();

       ByteArrayOutputStream outStream = new ByteArrayOutputStream();

                RandomAccessFile raf = new RandomAccessFile (CDRpath, "r");
                byte b[] = new byte[4096];
                int len;
                while ((len = raf.read(b)) > -1)
                        out.write (b, 0, len);

                out.close ();
                raf.close ();

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to