<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR" %> <%@ page import="java.io.*" %> <% String filename = request.getParameter("filename"); String location = request.getParameter("location"); File file = null; BufferedInputStream fin = null; BufferedOutputStream outs = null; try { file = new File(location, filename); response.reset(); response.setHeader("Context-Type", "application"); response.setHeader("Content-Disposition", "attachment;filename=" + filename + ";"); if (file != null) { fin = new BufferedInputStream(new FileInputStream(file)); outs = new BufferedOutputStream(response.getOutputStream()); int read = 0; while ((read = fin.read()) != -1) { outs.write(read); } } } catch(Exception e) { response.setContentType("text/html;charset=euc-kr;"); out.println(""); } finally { if(outs != null) fin.close(); if(fin != null) outs.close(); } %>