<%@ page contentType="text/html" pageEncoding="euc-kr"%>
<%@page import="java.util.*,java.io.*"%>
<%
String filepath = request.getRealPath("/upload") + "\\";
String filename = request.getParameter("fileName");
//System.out.println(filepath + "----" + filename);
byte b[] = new byte[600];
File files = new File(filepath + filename);
if (!files.exists()) {
%>
<script>
alert('?? ??? ???? ????!');
window.history.back();
</script>
<%
} else {
OutputStream outStream = response.getOutputStream();
response
.setContentType("application/x-msdownload;charset=UTF-8");
response.setHeader("content-disposition",
"attachment;filename=" + filename);
FileInputStream in = new FileInputStream(files);
int n = 0;
while ((n = in.read(b)) != -1) {
outStream.write(b, 0, n);
}
in.close();
outStream.flush();
outStream.close();
out.clear();
out = pageContext.pushBody();
}
%>
posted on 2008-12-15 17:09
長春語林科技 閱讀(195)
評論(0) 編輯 收藏 所屬分類:
util