2楼
呵呵,我竟然是第一个来下的啊~~~
谢谢楼主~~
回复
3楼
TANK YOU
回复
4楼
我怎么下载不了???
出现下面的东东:
/*response.setContentType("application/octet-stream");
// if (request.getHeader("User-Agent").indexOf("MSIE 5.5") != -1) {
// MS IE5.5 有要作特別處理
// response.setHeader("Content-Disposition","filename=\"" + fname + "\"");
// } else {
// 非 IE5.5 的 Header 設定方式
response.setHeader( "Content-Disposition", "attachment;filename=\"" + fname + "\"");
//}
FileInputStream fis = null;
fis = new FileInputStream(pageContext.getServletContext().getRealPath(src_fname));
ServletOutputStream ois = response.getOutputStream();
BufferedInputStream bis = new BufferedInputStream(fis);
BufferedOutputStream bos = new BufferedOutputStream(ois);
byte[] buff = new byte[2048]; int bytesRead;
try {
while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
}
catch (Exception e) {
System.out.println("file "+pageContext.getServletContext().getRealPath(src_fname)+" not found");
out.clearBuffer();
response.setContentType("text/html; charset=GBK");
response.setHeader("Content-disposition", "inline");
out.println("<HTML><BODY><P>");
out.println(e.toString());
out.println("</P></BODY></HTML>");
}
if (bis != null)
bis.close();
if (bos != null)
bos.close();
if (fis != null)
fis.close();
System.out.println("sajdlk;fjlsd");
*/
return; // 避免下面多按了 Enter 鍵而輸出多餘的換行字元.
%>
回复
5楼
可以下载,谢谢楼主!
回复
6楼
谢谢楼主!
回复
7楼
very very thanks
回复
8楼
谢!
回复
9楼
已经下载过
回复
10楼
能下载,谢谢了。
回复
11楼
谢谢!
回复