<%@page import="java.util.ArrayList"%><%@page import="java.io.OutputStream"%><%@page import="java.io.FileInputStream"%><%@page import="java.util.Date"%><%@page import="java.net.URLEncoder"%><%@page import="com.pcyi.walkone.DAO.Verify"%><%@page import="org.hibernate.Session"%><%out.clear();//要給clinet下載時顯示的名字String fileName = "clinet.txt";fileName=URLEncoder.encode(fileName, "utf-8");response.setHeader("Content-Disposition","attachment; filename=" + fileName );String f_path="server_file.txt";FileInputStream fis = new FileInputStream( application.getRealPath(f_path));OutputStream os=response.getOutputStream();byte byteRead;while(-1 != (byteRead = (byte)fis.read())) {  //文字檔UNIX換行轉PC換行  if(byteRead=='\n'){    os.write('\r');  }  os.write(byteRead);}os.close();if (fis != null) {  response.setStatus(200);  response.flushBuffer();  fis.close();}%>


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 gan068 的頭像
    gan068

    gan068

    gan068 發表在 痞客邦 留言(0) 人氣()