파일 업로드, 다운로드 기능 보완
This commit is contained in:
parent
dabd250fb2
commit
8bf7d93ec0
@ -14,7 +14,7 @@
|
|||||||
<repStatus>답변완료</repStatus>
|
<repStatus>답변완료</repStatus>
|
||||||
<email>myid@digitalship.co.kr</email>
|
<email>myid@digitalship.co.kr</email>
|
||||||
<contentQeust>질문이 있습니다.</contentQeust>
|
<contentQeust>질문이 있습니다.</contentQeust>
|
||||||
<contentQeustFile>111111=화면캡쳐.jpg;222222=화면캡쳐2.jpg;</contentQeustFile>
|
<contentQeustFile>F20210802052436092_0A84FA72B1B1478ABEB285536B81B587=엑셀샘플.xlsx;F20210802052436092_F1DB407F181A4B8AAA0859E56D4EDB57=엑셀샘플2.xlsx;</contentQeustFile>
|
||||||
<contentReply>이렇게 답변 드립니다.</contentReply>
|
<contentReply>이렇게 답변 드립니다.</contentReply>
|
||||||
<contentReplyFile>333333=결과확인.jpg;</contentReplyFile>
|
<contentReplyFile>333333=결과확인.jpg;</contentReplyFile>
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,12 @@
|
|||||||
<!-- uac.service.board.qna_PUT.xml -->
|
<!-- uac.service.board.qna_PUT.xml -->
|
||||||
<result>
|
<result>
|
||||||
<!-- 상세내용 -->
|
<!-- 상세내용 -->
|
||||||
|
|
||||||
|
<!-- 오류처리
|
||||||
|
<code>-200</code>
|
||||||
|
<message>이상합니다.</message>
|
||||||
|
-->
|
||||||
|
|
||||||
<articleNo>10</articleNo>
|
<articleNo>10</articleNo>
|
||||||
</result>
|
</result>
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,11 +2,13 @@
|
|||||||
package nlib.bbs.web;
|
package nlib.bbs.web;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -19,6 +21,11 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import nlib.bbs.service.BoardService;
|
import nlib.bbs.service.BoardService;
|
||||||
import nlib.cmm.NlibCommonController;
|
import nlib.cmm.NlibCommonController;
|
||||||
import nlib.cmm.crypto.AriaCrypto;
|
import nlib.cmm.crypto.AriaCrypto;
|
||||||
@ -226,11 +233,16 @@ public class BoardController extends NlibCommonController
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/board/insertQnAForm.do")
|
@RequestMapping("/board/insertQnAForm.do")
|
||||||
public String insertQnAForm(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) {
|
public String insertQnAForm(HttpServletRequest req, Authentication authentication
|
||||||
|
, @RequestParam Map<String, String> paramMap
|
||||||
|
, ModelMap model) {
|
||||||
|
|
||||||
|
// 입력 매개변수 출력 설정
|
||||||
|
addParamsToModel(paramMap, model);
|
||||||
|
|
||||||
NlibLoginVO loginVO = getNlibLoginVO(authentication);
|
NlibLoginVO loginVO = getNlibLoginVO(authentication);
|
||||||
model.addAttribute("regUserName", loginVO.getName());
|
if(StringUtil.isEmpty(paramMap.get("regUserName"))) model.addAttribute("regUserName", loginVO.getName());
|
||||||
model.addAttribute("email", loginVO.getEmail());
|
if(StringUtil.isEmpty(paramMap.get("email"))) model.addAttribute("regUserName", loginVO.getEmail());
|
||||||
|
|
||||||
return "nlib/board/insertQnAForm";
|
return "nlib/board/insertQnAForm";
|
||||||
}
|
}
|
||||||
@ -256,15 +268,55 @@ public class BoardController extends NlibCommonController
|
|||||||
reqVO.addInfoItem("email" , paramMap.get("email"));
|
reqVO.addInfoItem("email" , paramMap.get("email"));
|
||||||
reqVO.addInfoItem("contentQeust", paramMap.get("contentQeust"));
|
reqVO.addInfoItem("contentQeust", paramMap.get("contentQeust"));
|
||||||
|
|
||||||
|
String fileListJsonStr = paramMap.get("fileList");
|
||||||
|
if(fileListJsonStr.startsWith("\"")) fileListJsonStr = fileListJsonStr.substring(1);
|
||||||
|
if(fileListJsonStr.endsWith("\"")) fileListJsonStr = fileListJsonStr.substring(0, fileListJsonStr.length()-1);
|
||||||
|
fileListJsonStr = fileListJsonStr.replaceAll("\\\\", "");
|
||||||
|
|
||||||
|
log.debug("fileList : " + fileListJsonStr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
List<Map<String, Object>> fileList = null;
|
||||||
|
try {
|
||||||
|
fileList = mapper.readValue(fileListJsonStr, new TypeReference<List<Map<String, Object>>>() {
|
||||||
|
});
|
||||||
|
|
||||||
|
for (Map<String, Object> map : fileList) {
|
||||||
|
MapUtils.debugPrint(System.out, "map", map);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (JsonMappingException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
log.debug("fileMap =" + fileList);
|
||||||
|
*/
|
||||||
|
reqVO.addInfoItem("fileList", fileListJsonStr);
|
||||||
|
|
||||||
// 요청
|
// 요청
|
||||||
DataApiResVO resVO = boardService.insertQnA(reqVO);
|
DataApiResVO resVO = boardService.insertQnA(reqVO);
|
||||||
|
|
||||||
// 처리결과 확인
|
// 처리결과 확인
|
||||||
if(!resVO.isSuccess()) {
|
if(!resVO.isSuccess()) {
|
||||||
message = resVO.getResultMessage();
|
message = resVO.getResultMessage();
|
||||||
|
model.addAttribute("message", message);
|
||||||
|
addParamsToModel(paramMap, model, null, "pageIndex,pageSize,searchKeyword");
|
||||||
|
addParamsToModel(paramMap, model, null,
|
||||||
|
"title,articlePassword,"
|
||||||
|
+ "regDate, regUserName, "
|
||||||
|
+ "email, contentQeust");
|
||||||
|
|
||||||
return "redirect:/board/insertQnAForm.do";
|
return "redirect:/board/insertQnAForm.do";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model.addAttribute("pageSize", paramMap.get("pageSize"));
|
||||||
|
model.addAttribute("message", "성공적으로 등록되었습니다.");
|
||||||
|
|
||||||
return "redirect:/board/listQnAs.do";
|
return "redirect:/board/listQnAs.do";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ public class NlibCommonController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public NlibLoginVO getNlibLoginVO(Authentication authentication) {
|
public NlibLoginVO getNlibLoginVO(Authentication authentication) {
|
||||||
if(authentication == null) return null;
|
if(authentication == null) return new NlibLoginVO();
|
||||||
|
|
||||||
return (NlibLoginVO)authentication.getPrincipal();
|
return (NlibLoginVO)authentication.getPrincipal();
|
||||||
}
|
}
|
||||||
@ -210,6 +210,8 @@ public class NlibCommonController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(existUpperMap) model.addAttribute(upperMapName, uppperMap);
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
72
src/main/java/nlib/cmm/fileupload/DownloadView.java
Normal file
72
src/main/java/nlib/cmm/fileupload/DownloadView.java
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
package nlib.cmm.fileupload;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.FileCopyUtils;
|
||||||
|
import org.springframework.web.servlet.view.AbstractView;
|
||||||
|
|
||||||
|
@Component("downloadView")
|
||||||
|
public class DownloadView extends AbstractView {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
File file = (File)model.get("downloadFile");
|
||||||
|
if(file != null) {
|
||||||
|
String fileName =(String)model.get("fname");
|
||||||
|
String userAgent = request.getHeader("User-Agent");
|
||||||
|
|
||||||
|
if(userAgent.indexOf("MSIE") > -1 || userAgent.indexOf("Trident") > -1){
|
||||||
|
//fileName = URLEncoder.encode(file.getName(), "utf-8").replaceAll("\\+", "%20");;
|
||||||
|
}else if(userAgent.indexOf("Chrome") > -1) {
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
for(int i=0; i<file.getName().length(); i++) {
|
||||||
|
char c = file.getName().charAt(i);
|
||||||
|
if(c > '~') {
|
||||||
|
sb.append(URLEncoder.encode(""+c, "UTF-8"));
|
||||||
|
}else {
|
||||||
|
sb.append(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//fileName = sb.toString();
|
||||||
|
}else {
|
||||||
|
//fileName = new String(file.getName().getBytes("utf-8"));
|
||||||
|
}
|
||||||
|
response.setContentType(getContentType());
|
||||||
|
response.setContentLength((int)file.length());
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\";");
|
||||||
|
response.setHeader("Content-Transfer-Encoding", "binary");
|
||||||
|
|
||||||
|
OutputStream out = response.getOutputStream();
|
||||||
|
FileInputStream fis = null;
|
||||||
|
try {
|
||||||
|
fis = new FileInputStream(file);
|
||||||
|
FileCopyUtils.copy(fis, out);
|
||||||
|
} catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}finally{
|
||||||
|
if(fis != null){
|
||||||
|
try{
|
||||||
|
fis.close();
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(out != null) {
|
||||||
|
out.flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
@ -69,14 +70,12 @@ public class FileUploadController {
|
|||||||
/**
|
/**
|
||||||
* 첨부파일이 저장되는 최상위 위치
|
* 첨부파일이 저장되는 최상위 위치
|
||||||
*/
|
*/
|
||||||
@Value("#{properties['fileupload.base.path']}")
|
private String FILEUPLOAD_BASE_PATH = nlibProperty.getProperty("fileupload.base.path");
|
||||||
private String FILEUPLOAD_BASE_PATH;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 첨부파일 임시 저장 위치
|
* 첨부파일 임시 저장 위치
|
||||||
*/
|
*/
|
||||||
@Value("#{properties['fileupload.temp.subpath']}")
|
private String FILEUPLOAD_TEMP_SUBPATH = nlibProperty.getProperty("fileupload.temp.subpath");
|
||||||
private String FILEUPLOAD_TEMP_SUBPATH;
|
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping(value="/fileupload/uploadFilesAjax.do", produces="application/json")
|
@RequestMapping(value="/fileupload/uploadFilesAjax.do", produces="application/json")
|
||||||
@ -182,5 +181,20 @@ public class FileUploadController {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value="/fileupload/downloadFiles.do")
|
||||||
|
public ModelAndView download(@RequestParam HashMap<Object, Object> params, ModelAndView mv) {
|
||||||
|
String fid = (String) params.get("fid");
|
||||||
|
String fname = (String) params.get("fname");
|
||||||
|
String subPath = nlibProperty.getProperty((String) params.get("subPathKey"));
|
||||||
|
|
||||||
|
String fullPath = FILEUPLOAD_BASE_PATH + "/" + subPath + "/" + fid;
|
||||||
|
File file = new File(fullPath);
|
||||||
|
|
||||||
|
mv.setViewName("downloadView");
|
||||||
|
mv.addObject("downloadFile", file);
|
||||||
|
mv.addObject("fname", fname);
|
||||||
|
|
||||||
|
return mv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
.antMatchers("/temp/**")
|
.antMatchers("/temp/**")
|
||||||
.antMatchers("/favicon/**")
|
.antMatchers("/favicon/**")
|
||||||
.antMatchers("/*/*Ajax.do")
|
.antMatchers("/*/*Ajax.do")
|
||||||
|
.antMatchers("/fileupload/**")
|
||||||
.antMatchers("/board/**")
|
.antMatchers("/board/**")
|
||||||
.antMatchers("/inform/**")
|
.antMatchers("/inform/**")
|
||||||
.antMatchers("/alert/**")
|
.antMatchers("/alert/**")
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<%
|
<%
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* @Class Name : listQnAs.jsp
|
* @Class Name : insertQnAForm.jsp
|
||||||
*
|
*
|
||||||
* @Description : 묻고답하기 목록을 조회한다.
|
* @Description : 묻고답하기 등록화면을 표출한다.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
|
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
|
||||||
@ -31,7 +31,12 @@
|
|||||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||||
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
|
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
|
||||||
|
|
||||||
<c:set var="pageTitle">묻고답하기 - 글쓰기</c:set>
|
<c:set var="pageTitle">묻고답하기 - 등록</c:set>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>${pageTitle}</title>
|
||||||
|
|
||||||
<!-- File Upload : 시작 -->
|
<!-- File Upload : 시작 -->
|
||||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/js/fileupload/dropzone.css" />
|
<link rel="stylesheet" href="${pageContext.request.contextPath}/js/fileupload/dropzone.css" />
|
||||||
@ -39,83 +44,164 @@
|
|||||||
<script src="${pageContext.request.contextPath}/js/fileupload/dropzone.js"></script>
|
<script src="${pageContext.request.contextPath}/js/fileupload/dropzone.js"></script>
|
||||||
<!-- File Upload : 종료 -->
|
<!-- File Upload : 종료 -->
|
||||||
|
|
||||||
<h3>${pageTitle }</h3>
|
<script type="text/javaScript">
|
||||||
|
var myDropzone = null; <% // 파일드롭다운 객체 %>
|
||||||
|
var fileList = new Array(); <% // 업로드된 파일 정보 %>
|
||||||
|
var IN_PROC = false; <% // 현재 상태가 업로드처리중에 있는지 여부 %>
|
||||||
|
|
||||||
<!-- 글쓰기 : 폼 -->
|
$(document).ready(function() {
|
||||||
<form:form commandName="reqInfo"
|
|
||||||
action="${pageContext.request.contextPath}/board/insertQnA.do"
|
|
||||||
method="post">
|
|
||||||
|
|
||||||
<table>
|
// 파일업로드 객체 생성
|
||||||
<tr>
|
myDropzone = new Dropzone("form#myDropzone", { url: "${pageContext.request.contextPath}/fileupload/uploadFilesAjax.do?subPathKey=fileupload.bbs.qna.subpath"});
|
||||||
<td>제목</td>
|
|
||||||
<td><input type="input" name="title" id="title" value="" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>작성자명</td>
|
|
||||||
<td><input type="input" name="writerName" id="writerName" value="" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>비밀번호</td>
|
|
||||||
<td><input type="input" name="password" id="password" value="" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>이메일</td>
|
|
||||||
<td><input type="input" name="email" id="email" value="" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>내용</td>
|
|
||||||
<td><textarea name="content" id="content" value=""></textarea></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>첨부파일</td>
|
|
||||||
<td><input type="input" name="email" id="email" value="" /></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<input type="button" name="btnNew" id="btnNew" value="확인"
|
// 각 파일별 업로드 성공시 호출됨 (1th called)
|
||||||
onclick="javascript:fileUploadNow();" />
|
myDropzone.on("success", function(file, responseText) {
|
||||||
<input type="button" name="btnNew" id="btnNew" value="취소"
|
var jobj = JSON.parse(responseText);
|
||||||
onclick="javascript:location.href='${pageContext.request.contextPath}/board/listQnAs.do';" />
|
console.log("file upload success : responseText = " + responseText);
|
||||||
|
console.log("fileUpDone count : " + fileList.length);
|
||||||
|
var idx = fileList.length;
|
||||||
|
fileList[idx] = {
|
||||||
|
"orignlFileNm" : jobj[0].orignlFileNm,
|
||||||
|
"streFileNm" : jobj[0].streFileNm,
|
||||||
|
"fileMg" : jobj[0].fileMg,
|
||||||
|
};
|
||||||
|
console.log("success : " + file.name + " -> " + "data > " + jobj[0].streFileNm);
|
||||||
|
//alert("file : status " + file.status);
|
||||||
|
});
|
||||||
|
|
||||||
</form:form>
|
// 각 파일별 업로드 처리 완료 시 호출됨 (2th called)
|
||||||
|
myDropzone.on("complete", function(file) {
|
||||||
|
console.log("개별 파일 처리 완료 > file = " + JSON.stringify(file));
|
||||||
|
});
|
||||||
|
|
||||||
|
// 모든 업로드 처리 완료 시 호출됨
|
||||||
|
myDropzone.on("queuecomplete", function() {
|
||||||
|
var targetCnt = this.getAcceptedFiles().length;
|
||||||
|
var uploadCnt = fileList.length;
|
||||||
|
|
||||||
|
if(uploadCnt > 0) {
|
||||||
|
$("#fileList").val(JSON.stringify(JSON.stringify(fileList)));
|
||||||
|
}
|
||||||
|
if(IN_PROC) {
|
||||||
|
if(targetCnt > 0 && targetCnt != uploadCnt) {
|
||||||
|
alert("총 " + targetCnt + "건의 첨부파일 중 " + uploadCnt + "건이 정상적으로 업로드 되었습니다. 게시물 등록을 계속 진행합니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn_insertSubmit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// 목록으로 이동
|
||||||
|
function fn_list() {
|
||||||
|
$('#articleForm').removeAttr('onsubmit');
|
||||||
|
|
||||||
|
$("#articleForm").attr("action", "${pageContext.request.contextPath}/board/listQnAs.do");
|
||||||
|
$("#articleForm").submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 등록 처리
|
||||||
|
function fn_insert() {
|
||||||
|
if(!validEmail($("#email").val())) {
|
||||||
|
alert("이메일 형식에 맞지 않습니다. 다시 확인하여 주시기 바랍니다.");
|
||||||
|
$("#email").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#articleForm").attr("action", "${pageContext.request.contextPath}/board/insertQnA.do");
|
||||||
|
if(!confirm("저장하시겠습니까?")) return false;
|
||||||
|
|
||||||
|
IN_PROC = true;
|
||||||
|
|
||||||
|
// 파일 업로드 처리
|
||||||
|
if(myDropzone.getAcceptedFiles().length > 0) {
|
||||||
|
myDropzone.processQueue();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//등록 처리
|
||||||
|
function fn_insertSubmit() {
|
||||||
|
$('#articleForm').removeAttr('onsubmit');
|
||||||
|
$("#articleForm").attr("action", "${pageContext.request.contextPath}/board/insertQnA.do");
|
||||||
|
$("#articleForm").submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>${pageTitle }</h1>
|
||||||
|
|
||||||
|
메시지 : <span style="color:red;">${message }</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<form name="articleForm" id="articleForm"
|
||||||
|
action="${pageContext.request.contextPath}/board/insertQnA.do"
|
||||||
|
method="post"
|
||||||
|
onsubmit="return fn_insert();">
|
||||||
|
|
||||||
|
<!-- HIDDEN 영역 : 시작 -->
|
||||||
|
<input type="text" name="pageIndex" id="pageIndex" title="페이지번호" value="${pageIndex}" readonly />
|
||||||
|
<input type="text" name="pageSize" id="pageSize" title="목록에 보여줄 글 개수" value="${pageSize}" readonly />
|
||||||
|
<input type="text" name="searchKeyword" id="searchKeyword" title="검색어" value="${searchKeyword}" readonly />
|
||||||
|
|
||||||
|
<input type="text" name="fileList" id="fileList" title="업로드파일목록" value="" readonly />
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<table class="table_content" style="width:100% !important;">
|
||||||
|
<tr>
|
||||||
|
<th>제목</th>
|
||||||
|
<td><input type="text" name="title" id="title" title="제목" value="${title}" size="100" maxlength="200" required /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>작성자</th>
|
||||||
|
<td><input type="text" name="regUserName" id="regUserName" title="작성자" value="${regUserName}" size="100" maxlength="200" required /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>비밀번호</th>
|
||||||
|
<td><input type="text" name="articlePassword" id="articlePassword" title="비밀번호" value="${articlePassword}" size="100" maxlength="200" required /><br/>
|
||||||
|
* 비밀번호 : SHA-256 암호화 처리 후, DB에 저장되며, 웹 화면에 표출될 때는 Aria로 AuthKey를 Salt값으로 하여 재암호화처리하고 BASE64로 다시한번 인코딩하여 표출함
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>이메일</th>
|
||||||
|
<td><input type="email" name="email" id="email" title="이메일" value="${email}" size="100" maxlength="200" required /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>질문내용</th>
|
||||||
|
<td><textarea name="contentQeust" id="contentQeust" cols="80" rows="10" required >${contentQeust}</textarea></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<input type="button" name="btnCancel" id="btnCancel" title="취소버튼" class="float" value="취소"
|
||||||
|
onclick="fn_list()" />
|
||||||
|
<input type="submit" name="btnSave" id="btnSave" title="저장버튼" class="float" value="저장" />
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
<div id="dropzone">
|
<div id="dropzone">
|
||||||
<form action="${pageContext.request.contextPath}/fileupload/uploadFile.do"
|
<form id="myDropzone" name="myDropzone"
|
||||||
class="dropzone needsclick" id="myDropzone" name="myDropzone">
|
action="${pageContext.request.contextPath}/fileupload/uploadFile.do"
|
||||||
<div class="dz-message needsclick">
|
class="dropzone needsclick" >
|
||||||
<button type="button" class="dz-button">Drop files here or click to select files.</button><br />
|
<div class="dz-message needsclick">
|
||||||
<span class="note needsclick">이곳에 파일을 끌어다 놓거나, 클릭하여 올릴 파일을 선택하세요.</span>
|
<button type="button" class="dz-button">Drop files here or click to select files.</button><br />
|
||||||
</div>
|
<span class="note needsclick">이곳에 파일을 끌어다 놓거나, 클릭하여 올릴 파일을 선택하세요.</span>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javaScript" language="javascript">
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
// 파일업로드 객체 생성
|
|
||||||
var myDropzone = new Dropzone("form#myDropzone", { url: "${pageContext.request.contextPath}/fileupload/uploadFilesAjax.do?subPathKey=fileupload.bbs.qna.subpath"});
|
|
||||||
|
|
||||||
// 각 파일별 업로드 성공시 호출됨
|
|
||||||
myDropzone.on("success", function(file) {
|
|
||||||
alert("success : " + file.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
myDropzone.on("complete", function(file) {
|
|
||||||
alert("complete : " + file.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
myDropzone.on("queuecomplete", function() {
|
|
||||||
alert("queuecomplete : " + file.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function fileUploadNow() {
|
|
||||||
myDropzone.processQueue();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|||||||
@ -122,7 +122,16 @@ function fn_delete(passwd) {
|
|||||||
<td colspan="4">${article.contentQeust}</td>
|
<td colspan="4">${article.contentQeust}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4">${article.contentQeustFile}</td>
|
<td colspan="4">
|
||||||
|
<%
|
||||||
|
// 파일정보 : 저장파일ID=원파일명
|
||||||
|
%>
|
||||||
|
<c:set var="contentQeustFileList" value="${fn:split(article.contentQeustFile,';')}" />
|
||||||
|
<c:forEach var="contentQuestFileItem" items="${contentQeustFileList }">
|
||||||
|
<c:set var="fInfo" value="${fn:split(contentQuestFileItem,'=')}" />
|
||||||
|
<a href="${pageContext.request.contextPath}/fileupload/downloadFiles.do?subPathKey=fileupload.bbs.qna.subpath&fid=${fInfo[0]}&fname=${fInfo[1]}">${fInfo[1]}</a><br/>
|
||||||
|
</c:forEach>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th rowspan="2">답변내용</th>
|
<th rowspan="2">답변내용</th>
|
||||||
|
|||||||
@ -100,7 +100,7 @@ function fn_update() {
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>작성자</th>
|
<th>작성자</th>
|
||||||
<td><input type="text" name="regUserName" id="regUserName" title="제목" value="${article.regUserName}" size="100" maxlength="200" required /></td>
|
<td><input type="text" name="regUserName" id="regUserName" title="작성자" value="${article.regUserName}" size="100" maxlength="200" required /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>이메일</th>
|
<th>이메일</th>
|
||||||
|
|||||||
@ -117,7 +117,7 @@
|
|||||||
url: null,
|
url: null,
|
||||||
method: "post",
|
method: "post",
|
||||||
withCredentials: false,
|
withCredentials: false,
|
||||||
parallelUploads: 2,
|
parallelUploads: 5,
|
||||||
uploadMultiple: false,
|
uploadMultiple: false,
|
||||||
maxFilesize: 256,
|
maxFilesize: 256,
|
||||||
paramName: "file",
|
paramName: "file",
|
||||||
@ -127,12 +127,13 @@
|
|||||||
//thumbnailHeight: 120,
|
//thumbnailHeight: 120,
|
||||||
thumbnailHeight: 60, // NLIB
|
thumbnailHeight: 60, // NLIB
|
||||||
filesizeBase: 1000,
|
filesizeBase: 1000,
|
||||||
maxFiles: null,
|
//maxFiles: null,
|
||||||
|
maxFiles: 3, // NLIB : 최대 업로드 가능한 파일수
|
||||||
params: {},
|
params: {},
|
||||||
clickable: true,
|
clickable: true,
|
||||||
ignoreHiddenFiles: true,
|
ignoreHiddenFiles: true,
|
||||||
// acceptedFiles: null,
|
// acceptedFiles: null,
|
||||||
acceptedFiles: "image/*", // NLIB
|
acceptedFiles: "image/*,.hwp,.xls,.xlsx,.ppt,.pptx,.doc,.docx,.txt", // NLIB
|
||||||
acceptedMimeTypes: null,
|
acceptedMimeTypes: null,
|
||||||
//autoProcessQueue: true,
|
//autoProcessQueue: true,
|
||||||
autoProcessQueue: false, // NLIB
|
autoProcessQueue: false, // NLIB
|
||||||
@ -142,17 +143,20 @@
|
|||||||
previewsContainer: null,
|
previewsContainer: null,
|
||||||
capture: null,
|
capture: null,
|
||||||
dictDefaultMessage: "Drop files here to upload",
|
dictDefaultMessage: "Drop files here to upload",
|
||||||
dictFallbackMessage: "파일 드래그앤드랍을 지원하지 않는 브라우저입니다.", // "Your browser does not support drag'n'drop file uploads.",
|
//dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
|
||||||
|
dictFallbackMessage: "파일 드래그앤드랍을 지원하지 않는 브라우저입니다.", // NLIB
|
||||||
dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
|
dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
|
||||||
dictFileTooBig: "파일이 너무 큽니다({{filesize}}MiB). 최대 크기 {{maxFilesize}}MiB를 넘을 수 없습니다.", // "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",
|
dictFileTooBig: "파일이 너무 큽니다({{filesize}}MiB). 최대 크기 {{maxFilesize}}MiB를 넘을 수 없습니다.", // "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",
|
||||||
dictInvalidFileType: "You can't upload files of this type.",
|
//dictInvalidFileType: "You can't upload files of this type.",
|
||||||
|
dictInvalidFileType: "허용된 파일 형식만 첨부가능합니다 (이미지,문서 파일) ", // NLIB
|
||||||
dictResponseError: "Server responded with {{statusCode}} code.",
|
dictResponseError: "Server responded with {{statusCode}} code.",
|
||||||
dictCancelUpload: "Cancel upload",
|
dictCancelUpload: "Cancel upload",
|
||||||
dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?",
|
dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?",
|
||||||
//dictRemoveFile: "Remove file",
|
//dictRemoveFile: "Remove file",
|
||||||
dictRemoveFile: "취소", // NLIB
|
dictRemoveFile: "취소", // NLIB
|
||||||
dictRemoveFileConfirmation: null,
|
dictRemoveFileConfirmation: null,
|
||||||
dictMaxFilesExceeded: "You can not upload any more files.",
|
//dictMaxFilesExceeded: "You can not upload any more files.",
|
||||||
|
dictMaxFilesExceeded: "이파일은, 첨부 가능 최대 개수를 초과하여 업로드되지 않습니다.", // NLIB
|
||||||
accept: function(file, done) {
|
accept: function(file, done) {
|
||||||
return done();
|
return done();
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user