| 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
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| 6 | HttpURLConnection을 사용하여 웹 페이지 액세스하기 (첫번째) | 황제낙엽 | 2006.12.28 | 718 |
| 5 | Servlet으로 구현한 파일 다운로드(download) 페이지 | 황제낙엽 | 2006.12.27 | 624 |
| » | JSP로 구현한 파일 다운로드(download) 페이지 | 황제낙엽 | 2006.12.27 | 2833 |
| 3 | 파일 Download로직 구현시에 참고할만한 내용 | 황제낙엽 | 2006.12.27 | 679 |
| 2 |
파일을 web 이외의 경로에 올린다음 보내는 코드 예제 (JDK1.3)
| 황제낙엽 | 2006.12.27 | 589 |
| 1 | NestedRuntimeException | 황제낙엽 | 2006.09.22 | 1596 |
