<%
String filename = "D:/t.txt ";
String filecopy = "t.txt ";
Java. Io. bufferedinputstream Bis = NULL;
Java. Io. bufferedoutputstream Bos = NULL;
Try {
File F = new file (filename );
Response. Reset ();
Outputstream OS = response. getoutputstream ();
Response. setcontenttype ("application/X-msdownload ");
Response. setcontenttype ("application/vnd. WAP. wmlc ");
Response. setHeader ("Content-disposition ",
"Attachment; filename =/" "+ filecopy + "/"");
Response. setContentLength (int) f. length ());
Bis = new java. io. BufferedInputStream (
New java. io. FileInputStream (filename ));
Bos = new java. io. BufferedOutputStream (OS );
Byte [] buff = new byte [1024];
Int bytesRead;
While (-1! = (BytesRead = bis. read (buff, 0, buff. length ))){
Bos. write (buff, 0, bytesRead );
}
} Catch (Exception e ){
E. printStackTrace ();
} Finally {
If (bis! = Null)
Bis. close ();
If (bos! = Null)
Bos. close ();
}
%>