fileDel.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.io.*" %>
<%@ include file="../../include/accessRight.jsp"%>
<%
String requestUrl = request.getHeader("referer");
String strAttachNo = request.getParameter("attachno");
if(strAttachNo==null) strAttachNo = "0";
int attachNo = Integer.parseInt(strAttachNo);
String fileName = "";
String rs_attachRoute = "";
query = "select saveFileNm, attachRoute from g_attachedFile where attachNo = ? ";
pstmt = conn.prepareStatement(query);
pstmt.setString(1,strAttachNo);
rs = pstmt.executeQuery();
String realPath = saveFolder;
String rs_filename = "";
String filename = "";
if(rs.next()){
rs_filename = rs.getString("saveFileNm");
if(rs_filename==null) rs_filename = "";
if(!rs_filename.equals("")){
filename = rs_filename ;
File f = new File(realPath + "/" + filename);
if(f.exists()){
f.delete();
}
}
}
rs.close();
pstmt.close();
query = "delete g_attachedFile where attachNo = ? ";
pstmt = conn.prepareStatement(query);
pstmt.setInt(1, attachNo);
pstmt.executeUpdate();
pstmt.close();
%>
<script type="text/javascript">
parent.$("#frm").attr({"action":"", "target":"_self"}).submit();
</script>
<%@include file="../../include/dbClose.jsp"%>
'Web > JSP_SERVLET' 카테고리의 다른 글
문자열 구분자 분리, 주의사항 (0) | 2016.05.02 |
---|---|
File Upload Rename Policy(파일이름 중복 정책) (0) | 2016.04.07 |
셀렉트박스 db 값, 선택 (0) | 2016.03.11 |
파일 다운로드 패키지화. 다운 ( 삭제도 보기 ) (0) | 2016.03.10 |
[JSP] checkbox 값 받기와 전송순서에 대하여 (0) | 2016.03.09 |
댓글