J

JSP 잘 아시는분 살려주세요...

<%
< %@ page contentType="application;" %>
<%@ page import="java.util.*,java.io.*,java.sql.*,java.text.*,java.sql.*"%>

.

.

.

.DB읽는코드

.

.

.

.

String file_path = rs.getString("FILE_STRE_COURS")+rs.getString("STRE_FILE_NM");
String file_name = new String(rs.getString("ORIGNL_FILE_NM").getBytes("euc-kr"),"8859_1");
String filename2 = file_name.substring(file_name.lastIndexOf("/")+1);
File file=new File(file_path);
byte b[]=new byte[(int)file.length()];
 if(file.isFile()){
 response.reset();
 response.setContentType("application/x-msdownload");
 response.setHeader("Content-Disposition","attachment;filename="+filename2+";");
 response.setHeader("Content-Length",String.valueOf(file.length()));
 response.setHeader("Content-Transper-Encoding", "binary");
 response.setContentLength((int)file.length());
   response.setHeader("Pargma", "no-cache");
  response.setHeader("Expires", "-1");
BufferedInputStream fin=new BufferedInputStream(new FileInputStream(file));
BufferedOutputStream outs=new BufferedOutputStream(response.getOutputStream());
int read=0;
while((read=fin.read(b))!=-1){outs.write(b,0,read);}
outs.close();
fin.close();
}
}

}catch(Exception e){
out.println("rs.next() Error ");
out.println(e.toString());
return;
}
rs.close();
stmt.close();
con.close();

.

.

.

.

.

.
%>

코드는 대략 이런식으로 되있는데 이게 어떤건 다운로드가 정상적으로 실행되고 어떤건 정상적으로 다운로드가 되지않고 400에러가 뜨는 골터지는 문제가 발생합니다...

어딜 어떻게 수정해야하는지 감도 안잡힙니다.. 도와주세요...



댓글 2개

경로를 확인하세요
이게 파일은 있어요 ㅠㅠ
댓글을 작성하시려면 로그인이 필요합니다.

자유게시판

203,429건
+
제목 글쓴이 날짜 조회
13-02-12 조회 1,246
13-02-12 조회 1,275
13-02-12 조회 1,291
13-02-11 조회 6,412
13-02-10 조회 1,174
13-02-10 조회 1,211
13-02-09 조회 1,198
13-02-07 조회 1,607
13-02-07 조회 2,034
13-02-07 조회 1,304
13-02-07 조회 1,343
13-02-06 조회 1,258
13-02-06 조회 2,620
13-02-06 조회 1,240
13-02-06 조회 1,279
13-02-06 조회 2,228
13-02-05 조회 1,437
13-02-05 조회 1,815
13-02-05 조회 1,812
13-02-04 조회 1,428