sitelink1 | |
---|---|
sitelink2 | |
sitelink3 | |
sitelink4 | |
sitelink5 | |
sitelink6 |
http://www.javaservice.net/~java/bbs/read.cgi?m=resource&b=servlet&c=r_p&n=1031273015&k=따끈 다운로드&d=tb#1031273015
<%@ page language="java"
import="java.io.*, java.text.*, java.lang.*, java.util.*"
contentType="application;"%>
<%
String down_root = "/home3/unievent/newdoc"; //다운로드 상위 디렉토리 경로
String att_file_path = request.getParameter("att_file_path");//다운로드 하위 디렉토리 경로
String att_file_name = //다운로드 파일 명
new String(request.getParameter("att_file_name").getBytes("8859_1"), "ksc5601");
InputStream in = null;
OutputStream os = null;
try
{
File file = new File(down_root + att_file_path, att_file_name );
in = new FileInputStream(file);
response.reset() ;
response.setContentType("application/smnet");
response.setHeader ("Content-Disposition", "attachment; filename="" +
new String(file.getName().getBytes(),"ISO8859_1")+""" );
response.setHeader ("Content-Length", ""+file.length() );
os = response.getOutputStream();
byte b[] = new byte[(int)file.length()];
int leng = 0;
while( (leng = in.read(b)) > 0 ){
os.write(b,0,leng);
}
} catch(Exception e) {
System.out.println(e);
}finally{
if(in !=null)try{in.close();}catch(Exception e){}
if(os !=null)try{os.close();}catch(Exception e){}
}
%>
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
POWERED BY 絶對高手
E-Mail : juldaegosu@hanmail.net
MSN : juldaegosu@hanmail.net
CyberHome: javacraft.net
Juldaegosu Never Stop
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
import="java.io.*, java.text.*, java.lang.*, java.util.*"
contentType="application;"%>
<%
String down_root = "/home3/unievent/newdoc"; //다운로드 상위 디렉토리 경로
String att_file_path = request.getParameter("att_file_path");//다운로드 하위 디렉토리 경로
String att_file_name = //다운로드 파일 명
new String(request.getParameter("att_file_name").getBytes("8859_1"), "ksc5601");
InputStream in = null;
OutputStream os = null;
try
{
File file = new File(down_root + att_file_path, att_file_name );
in = new FileInputStream(file);
response.reset() ;
response.setContentType("application/smnet");
response.setHeader ("Content-Disposition", "attachment; filename="" +
new String(file.getName().getBytes(),"ISO8859_1")+""" );
response.setHeader ("Content-Length", ""+file.length() );
os = response.getOutputStream();
byte b[] = new byte[(int)file.length()];
int leng = 0;
while( (leng = in.read(b)) > 0 ){
os.write(b,0,leng);
}
} catch(Exception e) {
System.out.println(e);
}finally{
if(in !=null)try{in.close();}catch(Exception e){}
if(os !=null)try{os.close();}catch(Exception e){}
}
%>
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
POWERED BY 絶對高手
E-Mail : juldaegosu@hanmail.net
MSN : juldaegosu@hanmail.net
CyberHome: javacraft.net
Juldaegosu Never Stop
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
11 | 일본어 전각 반각 변환 예제 소스 .첫번째 | 황제낙엽 | 2007.01.10 | 3070 |
10 | 환경파일 로드 클래스 구성 (XML파싱) | 황제낙엽 | 2007.01.05 | 62 |
9 | HttpURLConnection을 사용하여 웹 페이지 액세스하기 (두번째) | 황제낙엽 | 2007.01.05 | 50 |
8 | 자바의 I/O 예제 [1] | 황제낙엽 | 2006.12.28 | 50 |
7 | HttpURLConnection 클래스를 이용한 Search | 황제낙엽 | 2006.12.28 | 260 |
6 | HttpURLConnection을 사용하여 웹 페이지 액세스하기 (첫번째) | 황제낙엽 | 2006.12.28 | 57 |
5 | Servlet으로 구현한 파일 다운로드(download) 페이지 | 황제낙엽 | 2006.12.27 | 112 |
» | JSP로 구현한 파일 다운로드(download) 페이지 | 황제낙엽 | 2006.12.27 | 77 |
3 | 파일 Download로직 구현시에 참고할만한 내용 | 황제낙엽 | 2006.12.27 | 95 |
2 | 파일을 web 이외의 경로에 올린다음 보내는 코드 예제 (JDK1.3) | 황제낙엽 | 2006.12.27 | 24 |
1 | NestedRuntimeException | 황제낙엽 | 2006.09.22 | 988 |