1. Let the browser pop-up "Download" dialog box
<% Response.setContentType ( "APPLICATION / OCTET-STREAM"); response.setHeader ( "Content-Disposition", "attachment; filename =" strShowFile ""); java.io.FileInputStream fileInputStream = new java.io.FileInputStream (Strfile); INT i; while ((i = fileInputstream.read ())! = -1) {Out.write (i);} fileinputstream.close (); out.close ();%>
STRSHOWFILE is the default name to be displayed when saving files, including extensions, Strfile is the file to download, including absolute directories.