feat:대용량 솔루션 진행중
@ -139,9 +139,13 @@ public class CommonWebController {
|
|||||||
|
|
||||||
@RequestMapping("/popup/fileUploadPop.do")
|
@RequestMapping("/popup/fileUploadPop.do")
|
||||||
public String fileUploadPop(@ModelAttribute("vEEduAplctVO") VEEduAplctVO vEEduAplctVO, ModelMap model, HttpServletRequest request) throws Exception{
|
public String fileUploadPop(@ModelAttribute("vEEduAplctVO") VEEduAplctVO vEEduAplctVO, ModelMap model, HttpServletRequest request) throws Exception{
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
//로그인 정보 가져오기
|
//로그인 정보 가져오기
|
||||||
LoginVO loginVO = checkLoginUtil.getAuthLoginVO();
|
LoginVO loginVO = checkLoginUtil.getAuthLoginVO();
|
||||||
vEEduAplctVO.setUserId(loginVO.getUniqId());
|
vEEduAplctVO.setUserId(loginVO.getUniqId());
|
||||||
|
System.out.println("===================== loginVO.getUniqId() :: " + loginVO.getUniqId());
|
||||||
|
|
||||||
String fileType = request.getParameter("fileType");
|
String fileType = request.getParameter("fileType");
|
||||||
System.out.println("=====================" + fileType);
|
System.out.println("=====================" + fileType);
|
||||||
@ -169,7 +173,10 @@ public class CommonWebController {
|
|||||||
List<FileVO> result = fileService.selectFileInfs(fileVO);
|
List<FileVO> result = fileService.selectFileInfs(fileVO);
|
||||||
model.addAttribute("fileList", result);
|
model.addAttribute("fileList", result);
|
||||||
model.addAttribute("fileListCnt", result.size());
|
model.addAttribute("fileListCnt", result.size());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
return "/web/ve/comm/fileUploadPop";
|
return "/web/ve/comm/fileUploadPop";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -159,3 +159,8 @@ Globals.pdf.webpath=/pdf/out/
|
|||||||
Globals.prod.islocal=local
|
Globals.prod.islocal=local
|
||||||
#\uc2e4\uc11c\ubc84
|
#\uc2e4\uc11c\ubc84
|
||||||
#Globals.prod.islocal=real
|
#Globals.prod.islocal=real
|
||||||
|
|
||||||
|
|
||||||
|
#\ub300\uc6a9\ub7c9 innorix license
|
||||||
|
Globals.Innorix.License=dev
|
||||||
|
Globals.Innorix.FilePath=/usr/local/tomcat/file/sht/
|
||||||
@ -152,3 +152,8 @@ Globals.pdf.webpath=/pdf/out/
|
|||||||
Globals.prod.islocal=local
|
Globals.prod.islocal=local
|
||||||
#\uc2e4\uc11c\ubc84
|
#\uc2e4\uc11c\ubc84
|
||||||
#Globals.prod.islocal=real
|
#Globals.prod.islocal=real
|
||||||
|
|
||||||
|
|
||||||
|
#\ub300\uc6a9\ub7c9 innorix license
|
||||||
|
Globals.Innorix.License=dev
|
||||||
|
Globals.Innorix.FilePath=/usr/local/tomcat/file/sht/
|
||||||
@ -158,3 +158,8 @@ Globals.pdf.webpath=/pdf/out/
|
|||||||
#Globals.prod.islocal=local
|
#Globals.prod.islocal=local
|
||||||
#\uc2e4\uc11c\ubc84
|
#\uc2e4\uc11c\ubc84
|
||||||
Globals.prod.islocal=real
|
Globals.prod.islocal=real
|
||||||
|
|
||||||
|
|
||||||
|
#\ub300\uc6a9\ub7c9 innorix license
|
||||||
|
Globals.Innorix.License=svr
|
||||||
|
Globals.Innorix.FilePath=/usr/local/tomcat/file/sht/
|
||||||
@ -1,16 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">
|
xmlns:util="http://www.springframework.org/schema/util"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
|
||||||
|
http://www.springframework.org/schema/util
|
||||||
|
http://www.springframework.org/schema/util/spring-util-4.0.xsd">
|
||||||
|
|
||||||
<!-- 환경설정 기본정보를 globals.properties 에서 참조하도록 propertyConfigurer 설정 -->
|
<!-- 환경설정 기본정보를 globals.properties 에서 참조하도록 propertyConfigurer 설정 -->
|
||||||
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||||
<property name="locations">
|
<property name="locations">
|
||||||
<list>
|
<list>
|
||||||
<!-- <value>classpath:/egovframework/egovProps/globals.properties</value> -->
|
|
||||||
<value>classpath:/egovframework/egovProps/globals_#{systemProperties['spring.profiles.active']}.properties</value>
|
<value>classpath:/egovframework/egovProps/globals_#{systemProperties['spring.profiles.active']}.properties</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
<util:properties id="property" location="classpath:/egovframework/egovProps/globals_#{systemProperties['spring.profiles.active']}.properties" />
|
||||||
|
|
||||||
<!-- datasource 설정(propertyConfigurer 활용) -->
|
<!-- datasource 설정(propertyConfigurer 활용) -->
|
||||||
<alias name="dataSource-${Globals.DbType}" alias="dataSource" />
|
<alias name="dataSource-${Globals.DbType}" alias="dataSource" />
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||||
<%@ taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator"%>
|
<%@ taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator"%>
|
||||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
|
||||||
|
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
|
||||||
<c:set var="URL" value="${pageContext.request.requestURL}" />
|
<c:set var="URL" value="${pageContext.request.requestURL}" />
|
||||||
<c:set var="URI" value="${pageContext.request.requestURI}" />
|
<c:set var="URI" value="${pageContext.request.requestURI}" />
|
||||||
|
|
||||||
@ -64,6 +65,14 @@
|
|||||||
<script nomodule src="${pageContext.request.contextPath}/visitEdu/usr/datapicker/duet.js"></script>
|
<script nomodule src="${pageContext.request.contextPath}/visitEdu/usr/datapicker/duet.js"></script>
|
||||||
<script src="${pageContext.request.contextPath}/visitEdu/usr/datapicker/duet.system.js"></script>
|
<script src="${pageContext.request.contextPath}/visitEdu/usr/datapicker/duet.system.js"></script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
대용량 솔루션 license 구분 값 추가
|
||||||
|
20230717 이호영
|
||||||
|
-->
|
||||||
|
<%-- <spring:eval expression="@property['Globals.Innorix.License']" var="license"/> --%>
|
||||||
|
<%-- <script src="<c:url value='/innorix/innorix_${license}.js' />"></script> --%>
|
||||||
|
<%-- <script src="<c:url value='/js/kccadr/innorixCommon.js' />"></script> --%>
|
||||||
|
<%-- <link rel="stylesheet" href="<c:url value='/innorix/innorix.css'/>" type="text/css"> --%>
|
||||||
<!--
|
<!--
|
||||||
contextpath sessionStorage에 저장
|
contextpath sessionStorage에 저장
|
||||||
20230705 이호영
|
20230705 이호영
|
||||||
|
|||||||
@ -10,6 +10,9 @@
|
|||||||
<un:useConstants var="VeConstants" className="kcc.ve.cmm.VeConstants" />
|
<un:useConstants var="VeConstants" className="kcc.ve.cmm.VeConstants" />
|
||||||
<% pageContext.setAttribute("replaceChar", "\n"); %>
|
<% pageContext.setAttribute("replaceChar", "\n"); %>
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||||
|
<spring:eval expression="@property['Globals.Innorix.License']" var="license"/>
|
||||||
|
<script src="<c:url value='/innorix/innorix_${license}.js' />"></script>
|
||||||
|
<script src="<c:url value='/js/kccadr/innorixCommon.js' />"></script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
input:disabled {
|
input:disabled {
|
||||||
|
|||||||
@ -8,16 +8,32 @@
|
|||||||
<%@ 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"%>
|
||||||
<%@ taglib prefix="un" uri="http://jakarta.apache.org/taglibs/unstandard-1.0" %>
|
<%@ taglib prefix="un" uri="http://jakarta.apache.org/taglibs/unstandard-1.0" %>
|
||||||
<un:useConstants var="VeConstants" className="kcc.ve.cmm.VeConstants" />
|
<%-- <un:useConstants var="VeConstants" className="kcc.ve.cmm.VeConstants" /> --%>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
대용량 솔루션 license 구분 값 추가
|
||||||
|
20230717 이호영
|
||||||
|
-->
|
||||||
|
<link rel="stylesheet" href="<c:url value='/innorix/innorix.css'/>" type="text/css">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ==================================================================
|
||||||
|
* INNORIX
|
||||||
|
* 파일 업로드 솔루션 init 셋팅
|
||||||
|
* ==================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
var control = new Object();
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
//파일첨부버튼
|
//파일첨부버튼
|
||||||
$(".btn_add_file").on('click', function(){
|
// $(".btn_add_file").on('click', function(){
|
||||||
$("#file_temp").click();
|
// $("#file_temp").click();
|
||||||
});
|
// });
|
||||||
|
|
||||||
$('#file_temp').change(function(e){
|
/* $('#file_temp').change(function(e){
|
||||||
var objUpload = $(".upload_area");
|
var objUpload = $(".upload_area");
|
||||||
var files = $('#file_temp')[0].files;
|
var files = $('#file_temp')[0].files;
|
||||||
|
|
||||||
@ -25,7 +41,7 @@
|
|||||||
if($("#file_temp").length > 0){
|
if($("#file_temp").length > 0){
|
||||||
$("#file_temp").val(""); //파일지우기
|
$("#file_temp").val(""); //파일지우기
|
||||||
}
|
}
|
||||||
});
|
}); */
|
||||||
|
|
||||||
// 레이어팝업 포커싱 이동 수정
|
// 레이어팝업 포커싱 이동 수정
|
||||||
/* $(".tooltip-close").click(function(){
|
/* $(".tooltip-close").click(function(){
|
||||||
@ -35,6 +51,30 @@
|
|||||||
var fileType = '${fileType}';
|
var fileType = '${fileType}';
|
||||||
$('#'+fileType).focus();
|
$('#'+fileType).focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ==================================================================
|
||||||
|
* INNORIX
|
||||||
|
* 파일전송 컨트롤 생성
|
||||||
|
* ==================================================================
|
||||||
|
*/
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl' // 컨트롤 출력 HTML 객체 ID
|
||||||
|
, transferMode: 'both' // 업로드, 다운로드 혼합사용
|
||||||
|
, installUrl: '<c:url value="/innorix/install/install.html" />' // Agent 설치 페이지
|
||||||
|
, uploadUrl: '/innorix/exam/upload.jsp' // 업로드 URL
|
||||||
|
// , uploadUrl: '<c:url value="/innorix/exam/upload.jsp" />' // 업로드 URL
|
||||||
|
, height:80
|
||||||
|
, width: 635
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 후 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
fn_callBackInnorix(p.files); // 파일 정보 DB isnert function
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function fncClose() {
|
function fncClose() {
|
||||||
@ -58,6 +98,34 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(confirm(setMsg + " 업로드 하시겠습니까?")){
|
||||||
|
if(control.getUploadFiles().length > 0){
|
||||||
|
var postObj = new Object();
|
||||||
|
postObj.innoDirPath = $('#innoDirPath').val();
|
||||||
|
control.setPostData(postObj); // 업로드시 함께 전달될 POST Param 추가
|
||||||
|
|
||||||
|
control.upload(); // 업로드 시작
|
||||||
|
}else{
|
||||||
|
alert("등록된 첨부파일이 없습니다.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* function fncSaveFile(type){
|
||||||
|
var setMsg = "";
|
||||||
|
if(type == 'TRANS') {
|
||||||
|
setMsg = "거래선을";
|
||||||
|
} else if (type == 'OATH') {
|
||||||
|
setMsg="서약서를";
|
||||||
|
} else if (type == 'PLAN') {
|
||||||
|
setMsg = "계획서를";
|
||||||
|
} else if (type == 'ATTEND') {
|
||||||
|
setMsg = "강사 참석 확인서를";
|
||||||
|
} else if (type == 'PHT') {
|
||||||
|
setMsg = "교육사진을";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var data = new FormData(document.getElementById("fileForm"));
|
var data = new FormData(document.getElementById("fileForm"));
|
||||||
//첨부파일 등록 처리-step1
|
//첨부파일 등록 처리-step1
|
||||||
//if(!data.get("fileSize")){
|
//if(!data.get("fileSize")){
|
||||||
@ -94,7 +162,7 @@
|
|||||||
error: function (e) { alert("저장에 실패하였습니다."); console.log("ERROR : ", e); }
|
error: function (e) { alert("저장에 실패하였습니다."); console.log("ERROR : ", e); }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
/* 등록되어 있는 파일 삭제버튼 클릭시 */
|
/* 등록되어 있는 파일 삭제버튼 클릭시 */
|
||||||
function delAtchFile(itemId , fileSn){
|
function delAtchFile(itemId , fileSn){
|
||||||
@ -143,11 +211,45 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 파일 정보 DB insert Ajax
|
||||||
|
* */
|
||||||
|
function fn_callBackInnorix(data){
|
||||||
|
|
||||||
|
var url = "<c:url value='/kccadr/common/insertInnorixFileAndRpplAjax.do' />";
|
||||||
|
|
||||||
|
var filePath = location.pathname;
|
||||||
|
var jspFileName = filePath.substring(filePath.lastIndexOf("/")+1, filePath.lastIndexOf("."));
|
||||||
|
|
||||||
|
var sendData = {
|
||||||
|
"adrSeq": $('#adrSeq').val()
|
||||||
|
, "adrSn": $('#adrSn').val()
|
||||||
|
, "adrDocTy": $('#adrDocTy').val()
|
||||||
|
, "rpplSeq": $('#rpplSeq').val()
|
||||||
|
, "adrDocCn1": $('#adrDocCn1').val()
|
||||||
|
, "openYn": $('#openYn').val()
|
||||||
|
, "jspFileName": jspFileName
|
||||||
|
, "innorixFileListVO": data
|
||||||
|
, "successMsg" : "사건문서 제출이 완료되었습니다."
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 공통 : innorixCommon.js
|
||||||
|
* fn_innorixCmmAjax() 호출 후 status가 성공(OK)이면 실행
|
||||||
|
*/
|
||||||
|
if(fn_innorixCmmAjax(sendData, url) == "OK")
|
||||||
|
{
|
||||||
|
opener.location.reload(true);
|
||||||
|
self.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- 파일 업로드 -->
|
<!-- 파일 업로드 -->
|
||||||
<form name="fileForm" id="fileForm" method="post" >
|
<form name="fileForm" id="fileForm" method="post" >
|
||||||
<input type="hidden" name="fileType" id="fileType" value="${fileType}" />
|
<input type="hidden" name="fileType" id="fileType" value="${fileType}" />
|
||||||
<input type="hidden" name="eduAplctOrd" id="eduAplctOrd" value="<c:out value='${info.eduAplctOrd}'/>"/> <!-- 사용자 아이디 -->
|
<input type="hidden" name="eduAplctOrd" id="eduAplctOrd" value="<c:out value='${info.eduAplctOrd}'/>"/> <!-- 사용자 아이디 -->
|
||||||
|
<input type="hidden" id="innoDirPath" value="<spring:eval expression="@globalSettings['Globals.Innorix.FilePath']"/>" />
|
||||||
<div class="tooltip-wrap">
|
<div class="tooltip-wrap">
|
||||||
<div class="popup_wrap popType03" tabindex="0" data-tooltip-con="sub35_pop01" data-focus="sub35_pop01" data-focus-prev="sub35_pop01_close">
|
<div class="popup_wrap popType03" tabindex="0" data-tooltip-con="sub35_pop01" data-focus="sub35_pop01" data-focus-prev="sub35_pop01_close">
|
||||||
<div class="popup_tit">
|
<div class="popup_tit">
|
||||||
@ -165,10 +267,12 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="pop_search_wrap">
|
<div class="pop_search_wrap">
|
||||||
<label for="fileNm" class="label">첨부파일 선택</label>
|
<label for="fileNm" class="label">첨부파일 선택</label>
|
||||||
<button type="button" class="btnType01 btn_add_file">찾아보기</button>
|
<!-- <button type="button" class="btnType01 btn_add_file">찾아보기</button> -->
|
||||||
<input type="file" id="file_temp" name="file_temp" class="uploadFile" style="display:none;"/>
|
<input type="file" id="file_temp" name="file_temp" class="uploadFile" style="display:none;"/>
|
||||||
|
<button type="button" onclick="control.openFileDialog();" class="btnType01 btn_add_file">파일찾기</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="file_wrap file_upload_box no_img_box">
|
<div id="fileControl"></div><br/>
|
||||||
|
<%-- <div class="file_wrap file_upload_box no_img_box">
|
||||||
<table>
|
<table>
|
||||||
<caption>첨부파일 리스트 : 파일명, 종류, 크기</caption>
|
<caption>첨부파일 리스트 : 파일명, 종류, 크기</caption>
|
||||||
<colgroup>
|
<colgroup>
|
||||||
@ -225,7 +329,7 @@
|
|||||||
</c:forEach>
|
</c:forEach>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div> --%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%--
|
<%--
|
||||||
|
|||||||
BIN
src/main/webapp/WEB-INF/lib/InnorixJAVA-v9.2-r1450.jar
Normal file
48
src/main/webapp/innorix/exam/autoAddFiles.html
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl',
|
||||||
|
installUrl: '../install/install.html',
|
||||||
|
uploadUrl: './upload.jsp'
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function addFiles() {
|
||||||
|
var fileArray = new Array();
|
||||||
|
// 자동으로 추가할 사용자측 파일목록 구성
|
||||||
|
var fileObj = new Object();
|
||||||
|
fileObj.filePath = "c:\\windows\\notepad.exe",
|
||||||
|
fileObj.fileSize = "246784",
|
||||||
|
|
||||||
|
fileArray.push(fileObj);
|
||||||
|
|
||||||
|
control.addFiles(fileArray); // 리스트 컨트롤에 파일 추가
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="파일 자동추가" onclick="addFiles();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1
src/main/webapp/innorix/exam/combine.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../innorix.css">
<script src="../innorix.js"></script>
<script>
var control = new Object();
window.onload = function() {
// 파일전송 컨트롤 생성
control = innorix.create({
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
transferMode: 'both', // 업로드, 다운로드 혼합사용
installUrl: '../install/install.html', // Agent 설치 페이지
uploadUrl: './upload.jsp' // 업로드 URL
});
// 업로드 완료 이벤트
control.on('uploadComplete', function (p) {
alert("업로드가 완료 되었습니다.\n다운로드 가능하게 재구성 합니다.");
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
var fileArray = new Array();
var f = p.files;
for (var i = 0; i < f.length; i++ ) {
var fileObj = new Object();
fileObj.printFileName = f[i].clientFileName;
fileObj.fileSize = f[i].fileSize;
fileObj.downloadUrl = urlBase + "download.jsp?fileName=" + f[i].serverFileName;
fileArray.push(fileObj);
}
console.log(fileArray);
control.removeAllFiles(); // 리스트 컨트롤에서 파일을 삭제
control.presetDownloadFiles(fileArray); // 다운로드 목록을 구성
});
};
</script>
</head>
<body>
<a href="../index.html">← 예제 목록</a><br /><br />
<div id="fileControl"></div><br/>
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
<input type="button" value="업로드" onclick="control.upload();"/> |
<input type="button" value="선택파일 다운로드" onclick="control.downloadSelectedFiles();"/>
<input type="button" value="전체 다운로드" onclick="control.download();"/>
</body>
</html>
|
||||||
BIN
src/main/webapp/innorix/exam/data/다수 피신청인 오류.JPG
Normal file
|
After Width: | Height: | Size: 19 KiB |
54
src/main/webapp/innorix/exam/download.html
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html' // Agent 설치 페이지
|
||||||
|
});
|
||||||
|
|
||||||
|
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||||
|
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||||
|
console.log('urlBase :', urlBase);
|
||||||
|
control.presetDownloadFiles(
|
||||||
|
[{
|
||||||
|
printFileName: "INNORIX WP 브로셔!!!.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP Brochure.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP パンフレット.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function getFileCount(){
|
||||||
|
var fileCount = control.getFileCount();
|
||||||
|
alert("allFileCount" + "\n" + fileCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||||
|
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||||
|
<input type="button" value="getFileCount" onClick="getFileCount();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
144
src/main/webapp/innorix/exam/download.jsp
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||||
|
<%@ page import="java.io.*" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||||
|
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
filePath
|
||||||
|
파일이 저장된 스토리지 전체경로
|
||||||
|
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||||
|
윈도우 - C:/storage/path1/path2/data
|
||||||
|
유닉스 - /storage/path1/path2/data
|
||||||
|
*/
|
||||||
|
|
||||||
|
// filePath = request.getParameter("innoDirPath");
|
||||||
|
filePath = "D:/usr/local/tomcat/file/sht/";
|
||||||
|
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||||
|
String szStartOffset = request.getParameter("_StartOffset");
|
||||||
|
String szEndOffset = request.getParameter("_EndOffset");
|
||||||
|
|
||||||
|
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||||
|
String fileID = request.getParameter("fileID");
|
||||||
|
String fileName = request.getParameter("fileName");
|
||||||
|
String sysFileName = new String();
|
||||||
|
String orgFileName = new String();
|
||||||
|
|
||||||
|
if (fileID != null) {
|
||||||
|
if (fileID.equals("1")) {
|
||||||
|
sysFileName = "sample-file.pdf"; // 시스템 저장 파일명
|
||||||
|
orgFileName = "INNORIX WP 브로셔.pdf"; // 원본 파일명
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileID.equals("2")) {
|
||||||
|
sysFileName = "sample-file.pdf";
|
||||||
|
orgFileName = "INNORIX WP Brochure.pdf";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileID.equals("3")) {
|
||||||
|
sysFileName = "sample-file.pdf";
|
||||||
|
orgFileName = "INNORIX WP パンフレット.pdf";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileName != null) {
|
||||||
|
sysFileName = "" + fileName;
|
||||||
|
sysFileName = "" + fileName;
|
||||||
|
// orgFileName = "data/" + fileName;
|
||||||
|
// orgFileName = "data/" + fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||||
|
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
|
||||||
|
File file = new File(filePath + sysFileName);
|
||||||
|
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setHeader("Accept-Ranges", "bytes");
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||||
|
|
||||||
|
long startOffset = 0;
|
||||||
|
long endOffset = 0;
|
||||||
|
|
||||||
|
if (szStartOffset != null) {
|
||||||
|
startOffset = Long.parseLong(szStartOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (szEndOffset != null) {
|
||||||
|
endOffset = Long.parseLong(szEndOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
long contentLength = 0;
|
||||||
|
|
||||||
|
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||||
|
contentLength = endOffset - startOffset + 1;
|
||||||
|
} else { // html 일반 다운로드 요청시
|
||||||
|
contentLength = file.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
response.setHeader("Content-Length", "" + contentLength);
|
||||||
|
|
||||||
|
byte b[] = new byte[8192];
|
||||||
|
BufferedInputStream input = null;
|
||||||
|
BufferedOutputStream output = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
input = new BufferedInputStream(new FileInputStream(file));
|
||||||
|
output = new BufferedOutputStream(response.getOutputStream());
|
||||||
|
|
||||||
|
int read = 0;
|
||||||
|
|
||||||
|
if (startOffset != 0) {
|
||||||
|
long n = input.skip(startOffset);
|
||||||
|
if (n == -1) read = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(contentLength > 0) {
|
||||||
|
while (contentLength > 0) {
|
||||||
|
if(contentLength < 8192) {
|
||||||
|
b = new byte[(int)contentLength];
|
||||||
|
}
|
||||||
|
|
||||||
|
read = input.read(b);
|
||||||
|
|
||||||
|
if(read == -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
output.write(b, 0, read);
|
||||||
|
contentLength = contentLength - read;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("fileID \t: " + fileID);
|
||||||
|
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||||
|
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||||
|
System.out.println("totalLength \t: " + file.length() );
|
||||||
|
System.out.println("startOffset \t: " + startOffset);
|
||||||
|
System.out.println("endOffset \t: " + endOffset);
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if(output != null) {
|
||||||
|
output.flush();
|
||||||
|
output.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(input != null) {
|
||||||
|
input.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
|
||||||
|
<%!
|
||||||
|
private String delimiterReplace(String fullDir)
|
||||||
|
{
|
||||||
|
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||||
|
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||||
|
|
||||||
|
return ret2;
|
||||||
|
}
|
||||||
|
%>
|
||||||
121
src/main/webapp/innorix/exam/downloadCustomTable.html
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<style>
|
||||||
|
button { font-size:9pt; }
|
||||||
|
table.fileTable {
|
||||||
|
width: 500px;
|
||||||
|
font-size: 9pt;
|
||||||
|
color: #333333;
|
||||||
|
border-width: 1px;
|
||||||
|
border-color: #c0c0c0;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
table.fileTable th {
|
||||||
|
border-width: 1px;
|
||||||
|
padding: 8px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #c0c0c0;
|
||||||
|
background-color: #dedede;
|
||||||
|
}
|
||||||
|
table.fileTable td {
|
||||||
|
border-width: 1px;
|
||||||
|
padding: 8px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #c0c0c0;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
#fileTable tr > .fileInfo { display:none; }
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
var control = new Object(); // 파일전송 컨트롤
|
||||||
|
|
||||||
|
innoJquery(document).ready(function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html' // Agent 설치 페이지
|
||||||
|
});
|
||||||
|
|
||||||
|
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||||
|
for (var i=1; i<4; i++) {
|
||||||
|
var _filePath = urlBase + "download.jsp?fileID=" + i;
|
||||||
|
var _fileSize = 1433885;
|
||||||
|
var _fileType = "normal";
|
||||||
|
|
||||||
|
var fileName = i + ". INNORIX WP 소개서.pdf";
|
||||||
|
var fileSize = bytesToSize(_fileSize);
|
||||||
|
var fileType = "일반";
|
||||||
|
|
||||||
|
// 다운로드 파일 목록을 커스텀 테이블에 추가
|
||||||
|
innoJquery('#fileTable > tbody:last').append(' \
|
||||||
|
<tr class="fileTable"> \
|
||||||
|
<td class="fileInfo">' + _filePath + '</td> \
|
||||||
|
<td class="fileInfo">' + _fileSize + '</td> \
|
||||||
|
<td class="fileInfo">' + _fileType + '</td> \
|
||||||
|
<td>' + fileName + '</td> \
|
||||||
|
<td>' + fileSize + '</td> \
|
||||||
|
<td>' + fileType + '</td> \
|
||||||
|
</tr> \
|
||||||
|
');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 파일 사이즈 bytes 를 KB, MB... 형식으로 변환
|
||||||
|
function bytesToSize(bytes) {
|
||||||
|
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
||||||
|
if (bytes == 0) return 'n/a';
|
||||||
|
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||||
|
if (i == 0) return bytes + ' ' + sizes[i];
|
||||||
|
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 커스텀 테이블 파일 정보를 확인
|
||||||
|
function getTableFiles() {
|
||||||
|
var tbl = innoJquery('#fileTable tr:has(td)').map(function(i, v) {
|
||||||
|
var innoJquerytd = innoJquery('td', this);
|
||||||
|
return {
|
||||||
|
downloadUrl: innoJquerytd.eq(0).text(),
|
||||||
|
fileSize: Number(innoJquerytd.eq(1).text()),
|
||||||
|
printFileName: innoJquerytd.eq(3).text()
|
||||||
|
}
|
||||||
|
}).get();
|
||||||
|
|
||||||
|
return tbl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 다운로드 실행
|
||||||
|
function download(obj, type) {
|
||||||
|
control.removeAllFiles(); // 이전에 컨트롤에 담겨진 파일정보 모두 삭제
|
||||||
|
var data = getTableFiles(); // 커스텀 테이블로부터 파일 다운로드 정보 얻어옴
|
||||||
|
control.presetDownloadFiles(data); // 커스텀 테이블의 파일정보를 컨트롤에 추가
|
||||||
|
setTimeout(function(){ control.download(); }, 500);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<table id="fileTable" class="fileTable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="fileInfo">filePath</th>
|
||||||
|
<th class="fileInfo">fileSize</th>
|
||||||
|
<th class="fileInfo">fileType</th>
|
||||||
|
<th>파일명</th>
|
||||||
|
<th>용량</th>
|
||||||
|
<th>구분</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div id="fileControl" style="display:none"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="모든파일 다운로드" onclick="download();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
61
src/main/webapp/innorix/exam/downloadMulti.html
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control1 = new Object();
|
||||||
|
var control2 = new Object();
|
||||||
|
|
||||||
|
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control1 = innorix.create({
|
||||||
|
el: '#fileControl1',
|
||||||
|
installUrl: '../install/install.html' // Agent 설치 페이지
|
||||||
|
});
|
||||||
|
|
||||||
|
control2 = innorix.create({
|
||||||
|
el: '#fileControl2',
|
||||||
|
installUrl: '../install/install.html'
|
||||||
|
});
|
||||||
|
|
||||||
|
control1.on('loadComplete', function (p) {
|
||||||
|
control1.presetDownloadFiles([{
|
||||||
|
printFileName: "INNORIX WEB PAGES 브로셔.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WEB PAGES Brochure.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
|
||||||
|
control2.on('loadComplete', function (p) {
|
||||||
|
control2.presetDownloadFiles([{
|
||||||
|
printFileName: "INNORIX WEB PAGES パンフレット.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl1"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="선택 다운로드" onclick="control1.downloadSelectedFiles();"/>
|
||||||
|
<input type="button" value="전체 다운로드" onclick="control1.download();"/><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl2"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="선택 다운로드" onclick="control2.downloadSelectedFiles();"/>
|
||||||
|
<input type="button" value="전체 다운로드" onclick="control2.download();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
49
src/main/webapp/innorix/exam/dropZone.html
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
window.onload = function() {
|
||||||
|
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 특정 html 객체를 파일추가용 DropZone 으로 활성
|
||||||
|
innoJquery("#dropZone").on({
|
||||||
|
"dragenter": function(innoJqueryevt) {
|
||||||
|
control.setDropZone(innoJqueryevt, this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<table id="dropZone" style="width:555px; height:150px; border: 1px solid green">
|
||||||
|
<tr><td align="center">Drop files and folders here</td></tr>
|
||||||
|
</table><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1
src/main/webapp/innorix/exam/edit.html
Normal file
1
src/main/webapp/innorix/exam/html5Combine.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../innorix.css">
<script src="../innorix.js"></script>
<script>
var control = new Object();
window.onload = function() {
// 파일전송 컨트롤 생성
control = innorix.create({
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
transferMode: 'both', // 업로드, 다운로드 혼합사용
agent: false, // true = Agent 설치, false = html5 모드 사용
installUrl: '../install/install.html', // Agent 설치 페이지
uploadUrl: './upload.jsp', // 업로드 URL
// width : 550, // 컨트롤 출력 너비(pixel)
height : 100 // 컨트롤 출력 높이(pixel)
});
// 업로드 완료 이벤트
control.on('uploadComplete', function (p) {
alert("업로드가 완료 되었습니다.\n다운로드 가능하게 재구성 합니다.");
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
var fileArray = new Array();
var f = p.files;
for (var i = 0; i < f.length; i++ ) {
var fileObj = new Object();
fileObj.printFileName = f[i].clientFileName;
fileObj.fileSize = f[i].fileSize;
fileObj.downloadUrl = urlBase + "download.jsp?fileName=" + f[i].serverFileName;
fileArray.push(fileObj);
}
control.removeAllFiles(); // 파일을 삭제
control.presetDownloadFiles(fileArray); // 다운로드 목록을 구성
});
};
</script>
</head>
<body>
<!-- <a href="../index.html">← 예제 목록</a><br /><br /> -->
<div id="fileControl"></div><br/>
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
<input type="button" value="업로드" class="uploadBtn" onclick="control.upload();"/> |
<input type="button" value="선택파일 다운로드" onclick="control.downloadSelectedFiles();"/>
<input type="button" value="전체 다운로드" onclick="control.download();"/>
</body>
</html>
|
||||||
1
src/main/webapp/innorix/exam/html5Combine_ori.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../innorix.css">
<script src="../innorix.js"></script>
<script>
var control = new Object();
window.onload = function() {
// 파일전송 컨트롤 생성
control = innorix.create({
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
transferMode: 'both', // 업로드, 다운로드 혼합사용
agent: false, // true = Agent 설치, false = html5 모드 사용
installUrl: '../install/install.html', // Agent 설치 페이지
uploadUrl: './upload.jsp' // 업로드 URL
});
// 업로드 완료 이벤트
control.on('uploadComplete', function (p) {
alert("업로드가 완료 되었습니다.\n다운로드 가능하게 재구성 합니다.");
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
var fileArray = new Array();
var f = p.files;
for (var i = 0; i < f.length; i++ ) {
var fileObj = new Object();
fileObj.printFileName = f[i].clientFileName;
fileObj.fileSize = f[i].fileSize;
fileObj.downloadUrl = urlBase + "download.jsp?fileName=" + f[i].serverFileName;
fileArray.push(fileObj);
}
control.removeAllFiles(); // 파일을 삭제
control.presetDownloadFiles(fileArray); // 다운로드 목록을 구성
});
};
</script>
</head>
<body>
<a href="../index.html">← 예제 목록</a><br /><br />
<div id="fileControl"></div><br/>
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
<input type="button" value="업로드" onclick="control.upload();"/> |
<input type="button" value="선택파일 다운로드" onclick="control.downloadSelectedFiles();"/>
<input type="button" value="전체 다운로드" onclick="control.download();"/>
</body>
</html>
|
||||||
48
src/main/webapp/innorix/exam/html5Download.html
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
agent: false, // true = Agent 설치, false = html5 모드 사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
});
|
||||||
|
|
||||||
|
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||||
|
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||||
|
console.log('urlBase :: ', urlBase);
|
||||||
|
control.presetDownloadFiles(
|
||||||
|
[{
|
||||||
|
printFileName: "INNORIX WP 브로셔.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP Brochure.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP パンフレット.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||||
|
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
37
src/main/webapp/innorix/exam/html5Upload.html
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
agent: false, // true = Agent 설치, false = html5 모드 사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- <a href="../index.html">← 예제 목록</a><br /><br /> -->
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
37
src/main/webapp/innorix/exam/html5Upload_ori.html
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
agent: false, // true = Agent 설치, false = html5 모드 사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1
src/main/webapp/innorix/exam/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<script>location.href="../index.html";</script>
|
||||||
78
src/main/webapp/innorix/exam/installCheck.html
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
// 강제 html5 모드여부 확인
|
||||||
|
var useHtml5 = !!(getCookie("forceHtml5Mode"));
|
||||||
|
|
||||||
|
// agent 설치 URL
|
||||||
|
var installUrl = "../install/install.html?redirect="+ encodeURIComponent("http://innorix.com");
|
||||||
|
|
||||||
|
// 강제 html5 모드가 아니면
|
||||||
|
|
||||||
|
if (useHtml5 != true) {
|
||||||
|
// agent 설치 또는 버전체크
|
||||||
|
innorix.checkVersion(function (result) {
|
||||||
|
if (result != true) {
|
||||||
|
location.href = installUrl;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: installUrl,
|
||||||
|
uploadUrl: './upload.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function getCookie( name ) {
|
||||||
|
var nameOfCookie = name + "=", endOfCookie, x = 0;
|
||||||
|
|
||||||
|
while ( x <= document.cookie.length ) {
|
||||||
|
var y = (x+nameOfCookie.length);
|
||||||
|
if ( document.cookie.substring( x, y ) == nameOfCookie ) {
|
||||||
|
if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
|
||||||
|
endOfCookie = document.cookie.length;
|
||||||
|
return unescape( document.cookie.substring( y, endOfCookie ) );
|
||||||
|
}
|
||||||
|
x = document.cookie.indexOf( " ", x ) + 1;
|
||||||
|
if ( x === 0 )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function setCookie( name, value, expiredays ) {
|
||||||
|
var todayDate = new Date();
|
||||||
|
todayDate.setDate( todayDate.getDate() + expiredays);
|
||||||
|
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" ;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
<input type="button" value="forceHtml5Mode 쿠키삭제" onclick="setCookie('forceHtml5Mode', false, 0);"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
53
src/main/webapp/innorix/exam/postParam.html
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function upload() {
|
||||||
|
var postObj = new Object();
|
||||||
|
postObj.type = "t31",
|
||||||
|
postObj.part = "p25"
|
||||||
|
|
||||||
|
/*
|
||||||
|
postObj =
|
||||||
|
{
|
||||||
|
type : "t31",
|
||||||
|
part : "p25",
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
control.setPostData(postObj); // 업로드시 함께 전달될 POST Param 추가
|
||||||
|
control.upload(); // 업로드 시작
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
18
src/main/webapp/innorix/exam/result.jsp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<%
|
||||||
|
request.setCharacterEncoding("UTF-8");
|
||||||
|
java.util.Enumeration names = request.getParameterNames();
|
||||||
|
|
||||||
|
while (names.hasMoreElements()) {
|
||||||
|
String name = (String)names.nextElement();
|
||||||
|
String values[] = request.getParameterValues(name);
|
||||||
|
|
||||||
|
if (values != null) {
|
||||||
|
for (int i=0; i< values.length; i++) {
|
||||||
|
System.out.println ( i + ". " + name + " = " + values[i]);
|
||||||
|
out.println ( i + ". " + name + " = " + values[i] + "<br />");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
40
src/main/webapp/innorix/exam/retrySet.html
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
retryCount: 1, // 전송 쓰레드 내부 재시도 횟수
|
||||||
|
retryDelay: 1, // 전송 쓰레드 내부 지연시간 second
|
||||||
|
maximumErrorCount: 3, // 전송창에 예외 3회 발생시 resume 모드로 전환 사용자가 버튼 클릭시 재시도
|
||||||
|
uploadUrl: './upload.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
src/main/webapp/innorix/exam/sample-file.pdf
Normal file
51
src/main/webapp/innorix/exam/upload.html
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<!-- <link rel="stylesheet" href="../innorix.css"> -->
|
||||||
|
<link rel="stylesheet" href="/offeduadvc/innorix/innorix.css">
|
||||||
|
<!-- <script src="../innorix.js"></script> -->
|
||||||
|
<script src="/offeduadvc/innorix/innorix_dev.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '/offeduadvc/innorix/install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: '/offeduadvc/innorix/exam/upload_test_220916.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
// innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
91
src/main/webapp/innorix/exam/upload.jsp
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||||
|
<%-- <%@ page import="egovframework.rte.fdl.property.EgovPropertyService" %> --%>
|
||||||
|
<%
|
||||||
|
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||||
|
if (request.getMethod().equals("POST"))
|
||||||
|
{
|
||||||
|
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||||
|
// directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||||
|
// directory = PropertyService.getString("Globals.fileStorePath");
|
||||||
|
directory = "/usr/local/tomcat/file/sht/";
|
||||||
|
int maxPostSize = 2147482624; // bytes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||||
|
|
||||||
|
/*
|
||||||
|
전달되는 _action Param 정보
|
||||||
|
speedCheck : 전송속도 측정
|
||||||
|
getServerInfo : 서버정보 확인
|
||||||
|
getFileInfo : 파일정보 확인
|
||||||
|
attachFile : 파일전송 진행
|
||||||
|
attachFileCompleted : 파일전송 완료
|
||||||
|
*/
|
||||||
|
|
||||||
|
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||||
|
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||||
|
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||||
|
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||||
|
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||||
|
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||||
|
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||||
|
String _el = uploader.getParameter("el"); // 컨트롤 엘리먼트 ID
|
||||||
|
String _type = uploader.getParameter("type"); // 커스텀 정의 POST Param 1
|
||||||
|
String _part = uploader.getParameter("part"); // 커스텀 정의 POST Param 2
|
||||||
|
String _transferId = uploader.getParameter("_transferId"); // TransferId
|
||||||
|
String _innoFilePath = uploader.getParameter("innoDirPath"); // 커스텀 정의 POST Param 2
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
현재 페이지를 호출하는 jsp에서
|
||||||
|
<input type="hidden" id="innoDirPath" value="<spring:eval expression="@globalSettings['Globals.Innorix.FilePath']"/>" />
|
||||||
|
위 코드를 작성하고
|
||||||
|
|
||||||
|
control.upload() 전에
|
||||||
|
|
||||||
|
|
||||||
|
var postObj = new Object();
|
||||||
|
postObj.innoDirPath = $('#innoDirPath').val();
|
||||||
|
control.setPostData(postObj); // 업로드시 함께 전달될 POST Param 추가
|
||||||
|
|
||||||
|
위 코드를 넣어 줘야 함
|
||||||
|
|
||||||
|
*/
|
||||||
|
uploader.setDirectory(_innoFilePath);
|
||||||
|
|
||||||
|
String _run_retval = uploader.run();
|
||||||
|
|
||||||
|
// 개별파일 업로드 완료
|
||||||
|
if (uploader.isUploadDone()) {
|
||||||
|
/*
|
||||||
|
System.out.println("========== uploader.isUploadDone() " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("_orig_filename \t = " + _orig_filename);
|
||||||
|
System.out.println("_new_filename \t = " + _new_filename);
|
||||||
|
System.out.println("_filesize \t = " + _filesize);
|
||||||
|
System.out.println("_filepath \t = " + _filepath);
|
||||||
|
System.out.println("_el \t = " + _el);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("_action \t = " + _action);
|
||||||
|
System.out.println("_run_retval \t = " + _run_retval);
|
||||||
|
System.out.println("_orig_filename \t = " + _orig_filename);
|
||||||
|
System.out.println("_new_filename \t = " + _new_filename);
|
||||||
|
System.out.println("_filesize \t = " + _filesize);
|
||||||
|
System.out.println("_start_offset \t = " + _start_offset);
|
||||||
|
System.out.println("_end_offset \t = " + _end_offset);
|
||||||
|
System.out.println("_filepath \t = " + _filepath);
|
||||||
|
System.out.println("_el \t = " + _el);
|
||||||
|
System.out.println("_type \t = " + _type);
|
||||||
|
System.out.println("_part \t = " + _part);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CORS 관련 헤더 추가
|
||||||
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
|
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||||
|
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||||
|
%>
|
||||||
165
src/main/webapp/innorix/exam/uploadCustomTable.html
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<style>
|
||||||
|
button { font-size:9pt; }
|
||||||
|
table.fileTable {
|
||||||
|
width: 500px;
|
||||||
|
font-size: 9pt;
|
||||||
|
color: #333333;
|
||||||
|
border-width: 1px;
|
||||||
|
border-color: #c0c0c0;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
table.fileTable th {
|
||||||
|
border-width: 1px;
|
||||||
|
padding: 8px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #c0c0c0;
|
||||||
|
background-color: #dedede;
|
||||||
|
}
|
||||||
|
table.fileTable td {
|
||||||
|
border-width: 1px;
|
||||||
|
padding: 8px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #c0c0c0;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
#fileTable tr > .fileInfo { display:none; }
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
var control = new Object(); // 파일전송 컨트롤
|
||||||
|
var tableRowInsert = true; // 파일 추가시 커스텀 테이블에 정보전달 여부
|
||||||
|
|
||||||
|
innoJquery(document).ready(function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
innoJquery("#dropZone").on({ // 외부 HTML 객체 DropZone 활성
|
||||||
|
"dragenter": function(innoJqueryevt) {
|
||||||
|
control.setDropZone(innoJqueryevt, this); // DropZone 으로 지정
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
console.log('f : ', f);
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 파일을 추가후 발생 이벤트
|
||||||
|
control.on('afterAddFiles', function (p) {
|
||||||
|
|
||||||
|
// 커스텀 테이블 사용하는 경우 선택된 파일정보 전달
|
||||||
|
if (tableRowInsert == true) {
|
||||||
|
for (var i = 0; i < p.length; i++ ) {
|
||||||
|
|
||||||
|
var _filePath = p[i].filePath;
|
||||||
|
var _fileSize = p[i].fileSize;
|
||||||
|
var _fileID = p[i].id;
|
||||||
|
var _fileType = "normal";
|
||||||
|
|
||||||
|
var arr = (_filePath.replace(/\\/gi,"/")).split("/");
|
||||||
|
var fileName = arr[arr.length-1];
|
||||||
|
var fileSize = bytesToSize(_fileSize);
|
||||||
|
var fileType = "일반";
|
||||||
|
|
||||||
|
if (_fileSize > 104857600) {
|
||||||
|
var _fileType = "large";
|
||||||
|
var fileType = "대용량";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 선택된 파일을 커스텀 테이블에 추가
|
||||||
|
innoJquery('#fileTable > tbody:last').append(' \
|
||||||
|
<tr class="fileTable"> \
|
||||||
|
<td class="fileInfo">' + _filePath + '</td> \
|
||||||
|
<td class="fileInfo">' + _fileSize + '</td> \
|
||||||
|
<td class="fileInfo">' + _fileType + '</td> \
|
||||||
|
<td>' + fileName + '</td> \
|
||||||
|
<td>' + fileSize + '</td> \
|
||||||
|
<td>' + fileType + '</td> \
|
||||||
|
<td><input type="button" value="삭제" onClick="deleteRow(this,\'' + _fileID + '\')"/></td> \
|
||||||
|
</tr> \
|
||||||
|
');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 파일 사이즈 bytes 를 KB, MB... 형식으로 변환
|
||||||
|
function bytesToSize(bytes) {
|
||||||
|
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
||||||
|
if (bytes == 0) return 'n/a';
|
||||||
|
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||||
|
if (i == 0) return bytes + ' ' + sizes[i];
|
||||||
|
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 커스텀 테이블 행 삭제
|
||||||
|
function deleteRow(obj, fileID) {
|
||||||
|
var row = obj.parentNode.parentNode;
|
||||||
|
row.parentNode.removeChild(row);
|
||||||
|
control.removeFileById(fileID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 커스텀 테이블 파일 정보를 확인
|
||||||
|
function getTableFiles() {
|
||||||
|
var tbl = innoJquery('#fileTable tr:has(td)').map(function(i, v) {
|
||||||
|
var innoJquerytd = innoJquery('td', this);
|
||||||
|
var type = innoJquerytd.eq(2).text();
|
||||||
|
if (type == "large") {
|
||||||
|
var uploadUrl = control.option.uploadUrl + "?type=large";
|
||||||
|
} else {
|
||||||
|
var uploadUrl = control.option.uploadUrl + "?type=normal";
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
basePath: "",
|
||||||
|
filePath: innoJquerytd.eq(0).text(),
|
||||||
|
fileSize: Number(innoJquerytd.eq(1).text()),
|
||||||
|
fileType: innoJquerytd.eq(2).text(),
|
||||||
|
uploadUrl: uploadUrl
|
||||||
|
}
|
||||||
|
}).get();
|
||||||
|
|
||||||
|
return tbl;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<body>
|
||||||
|
<!-- <a href="../index.html">← 예제 목록</a><br /><br /> -->
|
||||||
|
<div id="dropZone" style="overflow:auto; width:500px; height:200px; border: 1px solid #c0c0c0;">
|
||||||
|
<table id="fileTable" class="fileTable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="fileInfo">filePath</th>
|
||||||
|
<th class="fileInfo">fileSize</th>
|
||||||
|
<th class="fileInfo">fileType</th>
|
||||||
|
<th>파일명</th>
|
||||||
|
<th>용량</th>
|
||||||
|
<th>구분</th>
|
||||||
|
<th>삭제</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="fileControl" style="display:none"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
165
src/main/webapp/innorix/exam/uploadCustomTable_ori.html
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<style>
|
||||||
|
button { font-size:9pt; }
|
||||||
|
table.fileTable {
|
||||||
|
width: 500px;
|
||||||
|
font-size: 9pt;
|
||||||
|
color: #333333;
|
||||||
|
border-width: 1px;
|
||||||
|
border-color: #c0c0c0;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
table.fileTable th {
|
||||||
|
border-width: 1px;
|
||||||
|
padding: 8px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #c0c0c0;
|
||||||
|
background-color: #dedede;
|
||||||
|
}
|
||||||
|
table.fileTable td {
|
||||||
|
border-width: 1px;
|
||||||
|
padding: 8px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #c0c0c0;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
#fileTable tr > .fileInfo { display:none; }
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
var control = new Object(); // 파일전송 컨트롤
|
||||||
|
var tableRowInsert = true; // 파일 추가시 커스텀 테이블에 정보전달 여부
|
||||||
|
|
||||||
|
innoJquery(document).ready(function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
innoJquery("#dropZone").on({ // 외부 HTML 객체 DropZone 활성
|
||||||
|
"dragenter": function(innoJqueryevt) {
|
||||||
|
control.setDropZone(innoJqueryevt, this); // DropZone 으로 지정
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
console.log('f : ', f);
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 파일을 추가후 발생 이벤트
|
||||||
|
control.on('afterAddFiles', function (p) {
|
||||||
|
|
||||||
|
// 커스텀 테이블 사용하는 경우 선택된 파일정보 전달
|
||||||
|
if (tableRowInsert == true) {
|
||||||
|
for (var i = 0; i < p.length; i++ ) {
|
||||||
|
|
||||||
|
var _filePath = p[i].filePath;
|
||||||
|
var _fileSize = p[i].fileSize;
|
||||||
|
var _fileID = p[i].id;
|
||||||
|
var _fileType = "normal";
|
||||||
|
|
||||||
|
var arr = (_filePath.replace(/\\/gi,"/")).split("/");
|
||||||
|
var fileName = arr[arr.length-1];
|
||||||
|
var fileSize = bytesToSize(_fileSize);
|
||||||
|
var fileType = "일반";
|
||||||
|
|
||||||
|
if (_fileSize > 104857600) {
|
||||||
|
var _fileType = "large";
|
||||||
|
var fileType = "대용량";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 선택된 파일을 커스텀 테이블에 추가
|
||||||
|
innoJquery('#fileTable > tbody:last').append(' \
|
||||||
|
<tr class="fileTable"> \
|
||||||
|
<td class="fileInfo">' + _filePath + '</td> \
|
||||||
|
<td class="fileInfo">' + _fileSize + '</td> \
|
||||||
|
<td class="fileInfo">' + _fileType + '</td> \
|
||||||
|
<td>' + fileName + '</td> \
|
||||||
|
<td>' + fileSize + '</td> \
|
||||||
|
<td>' + fileType + '</td> \
|
||||||
|
<td><input type="button" value="삭제" onClick="deleteRow(this,\'' + _fileID + '\')"/></td> \
|
||||||
|
</tr> \
|
||||||
|
');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 파일 사이즈 bytes 를 KB, MB... 형식으로 변환
|
||||||
|
function bytesToSize(bytes) {
|
||||||
|
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
||||||
|
if (bytes == 0) return 'n/a';
|
||||||
|
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||||
|
if (i == 0) return bytes + ' ' + sizes[i];
|
||||||
|
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 커스텀 테이블 행 삭제
|
||||||
|
function deleteRow(obj, fileID) {
|
||||||
|
var row = obj.parentNode.parentNode;
|
||||||
|
row.parentNode.removeChild(row);
|
||||||
|
control.removeFileById(fileID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 커스텀 테이블 파일 정보를 확인
|
||||||
|
function getTableFiles() {
|
||||||
|
var tbl = innoJquery('#fileTable tr:has(td)').map(function(i, v) {
|
||||||
|
var innoJquerytd = innoJquery('td', this);
|
||||||
|
var type = innoJquerytd.eq(2).text();
|
||||||
|
if (type == "large") {
|
||||||
|
var uploadUrl = control.option.uploadUrl + "?type=large";
|
||||||
|
} else {
|
||||||
|
var uploadUrl = control.option.uploadUrl + "?type=normal";
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
basePath: "",
|
||||||
|
filePath: innoJquerytd.eq(0).text(),
|
||||||
|
fileSize: Number(innoJquerytd.eq(1).text()),
|
||||||
|
fileType: innoJquerytd.eq(2).text(),
|
||||||
|
uploadUrl: uploadUrl
|
||||||
|
}
|
||||||
|
}).get();
|
||||||
|
|
||||||
|
return tbl;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
<div id="dropZone" style="overflow:auto; width:500px; height:200px; border: 1px solid #c0c0c0;">
|
||||||
|
<table id="fileTable" class="fileTable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="fileInfo">filePath</th>
|
||||||
|
<th class="fileInfo">fileSize</th>
|
||||||
|
<th class="fileInfo">fileType</th>
|
||||||
|
<th>파일명</th>
|
||||||
|
<th>용량</th>
|
||||||
|
<th>구분</th>
|
||||||
|
<th>삭제</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="fileControl" style="display:none"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
84
src/main/webapp/innorix/exam/uploadMulti.html
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control1 = new Object(); // 파일전송 컨트롤 1
|
||||||
|
var control2 = new Object(); // 파일전송 컨트롤 2
|
||||||
|
var control3 = new Object(); // 파일전송 컨트롤 3
|
||||||
|
|
||||||
|
function uploadAll() {
|
||||||
|
control3.addFiles(control1.getAllFiles());
|
||||||
|
control3.addFiles(control2.getAllFiles());
|
||||||
|
control3.upload();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control1 = innorix.create({
|
||||||
|
el: '#fileControll', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp?el=fileControll'
|
||||||
|
});
|
||||||
|
|
||||||
|
control2 = innorix.create({
|
||||||
|
el: '#fileControl2',
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp?el=fileControl2'
|
||||||
|
});
|
||||||
|
|
||||||
|
control3 = innorix.create({
|
||||||
|
el: '#fileControl3',
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp'
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control1.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
|
||||||
|
control2.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
|
||||||
|
control3.on('uploadComplete', function (p) {
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
<div id="fileControll"></div><br />
|
||||||
|
|
||||||
|
<input type="button" value="파일추가" onclick="control1.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control1.upload();" /><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl2"></div><br />
|
||||||
|
|
||||||
|
<input type="button" value="파일추가" onclick="control2.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control2.upload();" /><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl3" style="display:none"></div>
|
||||||
|
|
||||||
|
<input type="button" value="전체 업로드" onclick="uploadAll();" />
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
68
src/main/webapp/innorix/exam/upload_ori.jsp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||||
|
if (request.getMethod().equals("POST"))
|
||||||
|
{
|
||||||
|
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||||
|
System.out.println("========== directory :: " + directory + " ==========");
|
||||||
|
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||||
|
int maxPostSize = 2147482624; // bytes
|
||||||
|
|
||||||
|
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||||
|
|
||||||
|
/*
|
||||||
|
전달되는 _action Param 정보
|
||||||
|
speedCheck : 전송속도 측정
|
||||||
|
getServerInfo : 서버정보 확인
|
||||||
|
getFileInfo : 파일정보 확인
|
||||||
|
attachFile : 파일전송 진행
|
||||||
|
attachFileCompleted : 파일전송 완료
|
||||||
|
*/
|
||||||
|
|
||||||
|
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||||
|
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||||
|
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||||
|
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||||
|
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||||
|
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||||
|
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||||
|
String _el = uploader.getParameter("el"); // 컨트롤 엘리먼트 ID
|
||||||
|
String _type = uploader.getParameter("type"); // 커스텀 정의 POST Param 1
|
||||||
|
String _part = uploader.getParameter("part"); // 커스텀 정의 POST Param 2
|
||||||
|
String _transferId = uploader.getParameter("_transferId"); // TransferId
|
||||||
|
String _run_retval = uploader.run();
|
||||||
|
|
||||||
|
// 개별파일 업로드 완료
|
||||||
|
if (uploader.isUploadDone()) {
|
||||||
|
/*
|
||||||
|
System.out.println("========== uploader.isUploadDone() " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("_orig_filename \t = " + _orig_filename);
|
||||||
|
System.out.println("_new_filename \t = " + _new_filename);
|
||||||
|
System.out.println("_filesize \t = " + _filesize);
|
||||||
|
System.out.println("_filepath \t = " + _filepath);
|
||||||
|
System.out.println("_el \t = " + _el);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("_action \t = " + _action);
|
||||||
|
System.out.println("_run_retval \t = " + _run_retval);
|
||||||
|
System.out.println("_orig_filename \t = " + _orig_filename);
|
||||||
|
System.out.println("_new_filename \t = " + _new_filename);
|
||||||
|
System.out.println("_filesize \t = " + _filesize);
|
||||||
|
System.out.println("_start_offset \t = " + _start_offset);
|
||||||
|
System.out.println("_end_offset \t = " + _end_offset);
|
||||||
|
System.out.println("_filepath \t = " + _filepath);
|
||||||
|
System.out.println("_el \t = " + _el);
|
||||||
|
System.out.println("_type \t = " + _type);
|
||||||
|
System.out.println("_part \t = " + _part);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CORS 관련 헤더 추가
|
||||||
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
|
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||||
|
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||||
|
%>
|
||||||
52
src/main/webapp/innorix/exam/upload_test_220916.html
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<!-- <link rel="stylesheet" href="../innorix.css"> -->
|
||||||
|
<link rel="stylesheet" href="/innorix/innorix.css">
|
||||||
|
<!-- <script src="../innorix.js"></script> -->
|
||||||
|
<script src="/innorix/innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '/innorix/install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: '/innorix/exam/upload_test_220916.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
innoJquery('form#f_write').submit();
|
||||||
|
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
397
src/main/webapp/innorix/gnIndex.html
Normal file
@ -0,0 +1,397 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ko">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=yes">
|
||||||
|
<meta name="author" content="(주)지엔기술">
|
||||||
|
<title>GNIT 이노릭스 샘플 목록</title>
|
||||||
|
<link rel="shortcut icon" href="./gnexam/img/favicon.ico" />
|
||||||
|
<link rel="stylesheet" href="./gnexam/css/gnit.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<header id="header">
|
||||||
|
<h1><img src="./gnexam/img/gnlogo.png">INNORIX SAMPLE LIST</h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="section">
|
||||||
|
<div class="cont-wrap">
|
||||||
|
<div class="notice-wrap">
|
||||||
|
<table class="notice-tb">
|
||||||
|
<colgroup>
|
||||||
|
<col style="width:50%">
|
||||||
|
<col style="width:50%">
|
||||||
|
</colgroup>
|
||||||
|
<tr>
|
||||||
|
<th colspan="2" class="notice-txt"><p>이노릭스는 사용하고 계시는 모드별로 제공되는 기능이 다릅니다. 샘플 비고란을 참고해주세요.</p></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="notice notice-a">
|
||||||
|
<p><img src="./gnexam/img/agent.png"> Agent 모드 </p>
|
||||||
|
<span>사용자 PC에 exe파일로 설치되며, 제공되는 기능이 더 많습니다. (agent : true)</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="notice notice-h">
|
||||||
|
<p><img src="./gnexam/img/html5.png"> Html5 모드 </p>
|
||||||
|
<span>무설치형으로 파일전송을 이용하며, 제약되는 기능이 있습니다. (agent : false)</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="origin-exam"><a href="./index.html">이노릭스제공 기본예제로 이동</a></p>
|
||||||
|
<div class="table-wrap">
|
||||||
|
<table class="list-tb">
|
||||||
|
<colgroup>
|
||||||
|
<col style="width:60px">
|
||||||
|
<col style="width:auto">
|
||||||
|
<col style="width:15%">
|
||||||
|
<col style="width:15%">
|
||||||
|
</colgroup>
|
||||||
|
<tr>
|
||||||
|
<th>No</th>
|
||||||
|
<th>기능설명</th>
|
||||||
|
<th>샘플</th>
|
||||||
|
<th>비고</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>커스텀 포스트데이터 전송(클라이언트→서버)</p>
|
||||||
|
<span class="refer">클라이언트메소트 setPostData, setFilePostDataByIndex를 이용한 포스트 데이터 전송</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/postData.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>업로드 시 커스텀 벨류 전송(서버→클라이언트)</p>
|
||||||
|
<span class="refer">서버메소드 setCustomValue를 이용한 커스텀 벨류 전송</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/uploadCustomValue.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>업로드 시 커스텀 에러 전송(서버→클라이언트)</p>
|
||||||
|
<span class="refer">InnorixCustomError 커스텀 에러 전송</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/uploadCustomError.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>업로드 시 서버 저장경로 변경</p>
|
||||||
|
<span class="refer">서버메소드 setDirectory를 이용한 서버 저장경로 지정</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/uploadSetDirectory.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>업로드 시 서버 저장파일명 변경</p>
|
||||||
|
<span class="refer">서버메소드 setFileName를 이용한 저장파일명 변경</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/changeFileName.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>업로드 서버경로 숨김 처리</p>
|
||||||
|
<span class="refer">서버메소드 setHideServerPathInfo를 이용한 서버경로 숨김 처리</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/hideServerPathInfo.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>업로드 파일 확장자 제한, 그룹화</p>
|
||||||
|
<span class="refer">allowExtension, limitExtension 옵션 활용법</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/uploadExtension.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>파일첨부 에러 시 메세지 출력(382이상 버전)</p>
|
||||||
|
<span class="refer">addFileError이벤트를 이용한 에러 메세지 출력</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/uploadAddFileError.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>파일첨부 에러 시 메세지 출력(373이하 버전)</p>
|
||||||
|
<span class="refer">addFileError이벤트를 이용한 에러 메세지 출력</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/uploadAddFileError_old.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>다운로드 시 커스텀 에러 전송(서버→클라이언트)</p>
|
||||||
|
<span class="refer">downloadCustomError 에러코드, 에러메시지 설정</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/downloadCustomError.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>다운로드 이중 무결성</p>
|
||||||
|
<span class="refer">다운로드 간 파일 해시 값을 이용한 이중 무결성 체크 예제</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/downloadIntegrity.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>다운로드 요청 간격 설정</p>
|
||||||
|
<span class="refer">downloadDelay옵션이용 ms단위 다운로드 딜레이 설정</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/downloadDelay.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>압축(.zip)하여 파일 다운로드</p>
|
||||||
|
<span class="refer">파일 다운로드 시 파일을 압축하여 다운로드</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/zipCombine.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>설정된 드랍존 영역을 확인하는 방법</p>
|
||||||
|
<span class="refer">isDebugDropZone옵션을 활용한 드랍존 영역 표시</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/debugDropZone.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>출력 언어 설정(한글/영어)</p>
|
||||||
|
<span class="refer">영어 메시지를 기본으로 출력하며 설정을 한글로 변경</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/setLanguage.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>에이전트 설치 시 팝업창으로 출력</p>
|
||||||
|
<span class="refer">installPopupWindow옵션활용 설치페이지 팝업창으로 출력</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/installPopup.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>삭제한 파일정보를 서버에 출력</p>
|
||||||
|
<span class="refer">파일추가 후 업로드 전 삭제된 파일에대한 정보출력</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/deleteFileInfo.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>전송 조각 사이즈변경, 세션 개수 설정</p>
|
||||||
|
<span class="refer">기본 조각 사이즈 2MB, 세션 16개가 적용</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/sliceSizeSession.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>오류 시 전송 시도 횟수</p>
|
||||||
|
<span class="refer">retryCount, retryDelay, maximumErrorCount 옵션활용</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/errorRetryCount.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>다운로드목록 구성 시 파일사이즈를 가상의사이즈로 지정 (Agent 모드)</p>
|
||||||
|
<span class="refer">isTempFileSize 옵션을 활용한 가상파일 사이즈 선언</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/isTempFileSize.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>다운로드목록 구성 시 파일사이즈를 가상의사이즈로 지정 (Html5 모드)</p>
|
||||||
|
<span class="refer">skipFileSizeCheck 옵션을 활용한 파일 사이즈 체크 건너 뜀용</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/skipFileSizeCheck.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>폴더구조 업로드, 다운로드</p>
|
||||||
|
<span class="refer">folderIntact, showFolderItems 옵션활용</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/upDownFolder.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>리스트 전송창 모드에서 파일별 전송상태 출력</p>
|
||||||
|
<span class="refer">showTransferFileStatus 옵션활용</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/showTransferFileStatus.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>파일 아이템 이동, 삭제 기능버튼 출력</p>
|
||||||
|
<span class="refer">useFuncBtn 옵션활용</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/useFuncBtn.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!--
|
||||||
|
미사용
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>커스텀테이블을 이용한 선택파일 다운로드</p>
|
||||||
|
<span class="refer"></span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/downloadSelectedFileCustomTable.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>커스텀테이블을 이용한 업로드 폴더 구조 나타내기</p>
|
||||||
|
<span class="refer">설명부분</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/uploadFolderCustomTable.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="ta_l">
|
||||||
|
<p>색상 변경 샘플</p>
|
||||||
|
<span class="refer">페이지 컨셉에 맞는 색상으로 변경 (커스텀)</span>
|
||||||
|
</td>
|
||||||
|
<td><a class="exam-link" href="./gnexam/upload.html">샘플보기</a></td>
|
||||||
|
<td>
|
||||||
|
<img src="./gnexam/img/agent.png">
|
||||||
|
<img src="./gnexam/img/html5.png">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
-->
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="notice notice-pdf">
|
||||||
|
<p><img src="./gnexam/img/pdf.png">이노릭스 참고 문서</p>
|
||||||
|
<span><a href="../INNORIX Platform WP v9.2 Manual.pdf" target="_blank">INNORIX Platform WP v9.2 Manual.pdf</a></span>
|
||||||
|
<span><a href="../이노릭스 에이전트 오동작 조치 매뉴얼.pdf" target="_blank">이노릭스 에이전트 오동작 조치 매뉴얼.pdf</a></span>
|
||||||
|
<span><a href="../INNORIX-WP-JSP-빠른설치-R2.pdf" target="_blank">INNORIX-WP-JSP-빠른설치-R2.pdf</a></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div><!-- //.section -->
|
||||||
|
|
||||||
|
<footer id="footer">
|
||||||
|
<p>추가 문의사항은 <em>innorix@gnit.co.kr</em>로 보내주시길 바랍니다.</p>
|
||||||
|
<span class="top_btn" onclick="window.scrollTo(0,0);">TOP</span>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
89
src/main/webapp/innorix/gnexam/agentImageUpload.html
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
innorix.setLanguage('ko');
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'upload', // 업로드, 다운로드 혼합사용
|
||||||
|
agent : true,
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
allowExtension : ["png", "jpg", "jpeg"],
|
||||||
|
showPreviewImage: true, // 이미지 미리보기
|
||||||
|
uploadUrl: './upload.jsp', // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
//innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 파일 선택 시
|
||||||
|
control.on('onSelectRows', function (p) {
|
||||||
|
console.log(p);
|
||||||
|
console.log('---------------------------');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function imageUpload(){
|
||||||
|
control.appendThumbnailProperty("ALL", 200, 200, "VERTICAL");
|
||||||
|
control.appendWatermarkProperty("ALL", "innorix_logo.png", "CENTER|BOTTOM");
|
||||||
|
|
||||||
|
control.upload();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
이미지 미리보기
|
||||||
|
- 옵션 : showPreviewImage: true
|
||||||
|
|
||||||
|
- 썸네일 생성(리사이징) : control.appendThumbnailProperty((1), (2), (3), (4));
|
||||||
|
(1) 리사이징을 진행할 원본 이미지 인덱스 Number를 입력해주시거나 ALL을 입력받습니다.
|
||||||
|
ex: control.appendThumnailProperty(1, 300, 300, "VERTICAL");
|
||||||
|
(2) 가로 픽셀 사이즈 (Number)
|
||||||
|
(3) 세로 픽셀 사이즈 (Number)
|
||||||
|
(4) 리사이징을 진행할 가로세로 기준
|
||||||
|
VERTICAL : 세로축 기준 리사이징
|
||||||
|
HORIZONTAL : 가로축 기준 리사이징
|
||||||
|
FIX : 설정한 사이즈에 맞게 리사이징(비율무시)
|
||||||
|
|
||||||
|
- 워터마크 추가 : control.appendWatermarkProperty((1), (2), (3));
|
||||||
|
(1) 워터마크를 적용할 원본 파일 인덱스 Number를 입력해주시거나 ALL을 입력받습니다.
|
||||||
|
ex : control.appendWatermarkProperty(2, "innorix_logo.png", "LEFT|MIDDLE")
|
||||||
|
(2) 워터마크 이미지 URL
|
||||||
|
(3) 워터마크를 적용할 위치 ("횡축|종축") ("가로|세로")
|
||||||
|
가로 기준 위치 : "LEFT" / "RIGHT" / "CENTER"
|
||||||
|
세로 기준 위치 : "TOP" / "BOTTOM" / "MIDDLE"
|
||||||
|
*/
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="resultImg.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="imageUpload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
55
src/main/webapp/innorix/gnexam/changeFileName.html
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
allowExtension: 'jpg', //jpg 확장자만 첨부 허용
|
||||||
|
uploadUrl: './changeFileName.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
console.log('실제 저장된 파일명 : '+f[i].serverFileName);
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
//innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 파일 첨부시 에러
|
||||||
|
control.on('addFileError', function (p) {
|
||||||
|
alert(p[0].message + "\n jpg 파일만 등록해주세요.");
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
69
src/main/webapp/innorix/gnexam/changeFileName.jsp
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||||
|
<%@ page import="java.util.UUID" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||||
|
if ("POST".equals(request.getMethod()))
|
||||||
|
{
|
||||||
|
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||||
|
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||||
|
int maxPostSize = 2147482624; // bytes
|
||||||
|
|
||||||
|
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||||
|
|
||||||
|
/*
|
||||||
|
전달되는 _action Param 정보
|
||||||
|
speedCheck : 전송속도 측정
|
||||||
|
getServerInfo : 서버정보 확인
|
||||||
|
getFileInfo : 파일정보 확인
|
||||||
|
attachFile : 파일전송 진행
|
||||||
|
attachFileCompleted : 파일전송 완료
|
||||||
|
*/
|
||||||
|
|
||||||
|
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||||
|
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||||
|
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||||
|
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||||
|
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||||
|
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||||
|
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||||
|
String _el = uploader.getParameter("el"); // 컨트롤 엘리먼트 ID
|
||||||
|
String _type = uploader.getParameter("type"); // 커스텀 정의 POST Param 1
|
||||||
|
String _part = uploader.getParameter("part"); // 커스텀 정의 POST Param 2
|
||||||
|
String _transferId = uploader.getParameter("_transferId"); // TransferId
|
||||||
|
|
||||||
|
|
||||||
|
// 파일정보 확인
|
||||||
|
if("getFileInfo".equals(_action)) {
|
||||||
|
/*
|
||||||
|
업로드 시 서버에 저장되는 파일 명 변경 (해당 예제는 랜덥값으로 서버에 저장되는 파일명을 설정)
|
||||||
|
- uploader.setFileName(파일명+확장자);
|
||||||
|
- 확장자 변경 시 파일은 열리지 않게 됩니다.
|
||||||
|
- upload.run()전에 위치
|
||||||
|
*/
|
||||||
|
String saveNm = UUID.randomUUID()+".jpg";
|
||||||
|
uploader.setFileName(saveNm);
|
||||||
|
}
|
||||||
|
|
||||||
|
String _run_retval = uploader.run();
|
||||||
|
|
||||||
|
// 개별파일 업로드 완료
|
||||||
|
if("attachFileCompleted".equals(_action)) {
|
||||||
|
/*
|
||||||
|
System.out.println("========== uploader.isUploadDone() " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("_orig_filename \t = " + _orig_filename);
|
||||||
|
System.out.println("_new_filename \t = " + _new_filename);
|
||||||
|
System.out.println("_filesize \t = " + _filesize);
|
||||||
|
System.out.println("_filepath \t = " + _filepath);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// CORS 관련 헤더 추가
|
||||||
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
|
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||||
|
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||||
|
%>
|
||||||
1
src/main/webapp/innorix/gnexam/combine.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../innorix.css">
<script src="../innorix.js"></script>
<script>
var control = new Object();
window.onload = function() {
// 파일전송 컨트롤 생성
control = innorix.create({
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
transferMode: 'both', // 업로드, 다운로드 혼합사용
installUrl: '../install/install.html', // Agent 설치 페이지
uploadUrl: './upload.jsp' // 업로드 URL
});
// 업로드 완료 이벤트
control.on('uploadComplete', function (p) {
alert("업로드가 완료 되었습니다.\n다운로드 가능하게 재구성 합니다.");
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
var fileArray = new Array();
var f = p.files;
for (var i = 0; i < f.length; i++ ) {
var fileObj = new Object();
fileObj.printFileName = f[i].clientFileName;
fileObj.fileSize = f[i].fileSize;
fileObj.downloadUrl = urlBase + "download.jsp?fileName=" + f[i].serverFileName;
fileArray.push(fileObj);
}
console.log(fileArray);
control.removeAllFiles(); // 리스트 컨트롤에서 파일을 삭제
control.presetDownloadFiles(fileArray); // 다운로드 목록을 구성
});
};
</script>
</head>
<body>
<a href="../index.html">← 예제 목록</a><br /><br />
<div id="fileControl"></div><br/>
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
<input type="button" value="업로드" onclick="control.upload();"/> |
<input type="button" value="선택파일 다운로드" onclick="control.downloadSelectedFiles();"/>
<input type="button" value="전체 다운로드" onclick="control.download();"/>
</body>
</html>
|
||||||
1
src/main/webapp/innorix/gnexam/combineTest.html
Normal file
88
src/main/webapp/innorix/gnexam/css/gnit.css
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
@charset "utf-8";
|
||||||
|
/* RESET CSS */
|
||||||
|
html, body, div, span, iframe,
|
||||||
|
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||||
|
a, abbr, address, em, img, ins, kbd, q, s, samp,
|
||||||
|
small, strike, strong, sub, sup, tt, var,
|
||||||
|
b, u, i, dl, dt, dd, menu, ol, ul, li,
|
||||||
|
fieldset, form, label, legend,
|
||||||
|
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||||
|
article, aside, canvas, details, embed,
|
||||||
|
figure, figcaption, footer, header, hgroup,
|
||||||
|
main, menu, nav, output, ruby, section, summary{font-family: 'NanumBarunGothic',sans-serif !important;margin: 0;padding: 0;border: 0;font: inherit;vertical-align: baseline;}
|
||||||
|
article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section {display: block;}
|
||||||
|
body {line-height: 1;}
|
||||||
|
menu, ol, ul, li {list-style: none;}
|
||||||
|
table {border-collapse: collapse;border-spacing: 0;}
|
||||||
|
a {color: #333;text-decoration: none;cursor: pointer;font-size:inherit;}
|
||||||
|
em {color: #73b644; font-weight: bold;}
|
||||||
|
i {font-style: italic;display: inline;}
|
||||||
|
|
||||||
|
.clear {clear: both;display: block;height: 0;overflow: hidden;visibility: hidden;width: 0;}
|
||||||
|
|
||||||
|
|
||||||
|
/* GNIT SAMPLE CSS */
|
||||||
|
html, body{min-width: 900px;}
|
||||||
|
#header{width: 100%; height: 70px; background-color: #73b644; border-bottom: 2px solid #539426; box-sizing: border-box; text-align: center;}
|
||||||
|
#header img{display: inline-block; height: 40px; padding:15px 20px; vertical-align: middle;}
|
||||||
|
#header h1{display: inline-block; font-size: 22px; color: #fff; font-weight: bold;}
|
||||||
|
|
||||||
|
#footer{width: 100%; height: 70px; background-color: #eff4e5; box-sizing: border-box; padding: 45px 0; border-top: 1px solid #539426;}
|
||||||
|
#footer p{color: #333; text-align: center;}
|
||||||
|
#footer .top_btn{
|
||||||
|
display: block; width: 50px; height: 50px;
|
||||||
|
background:url('../img/top_btn.jpg') 0 0 no-repeat; text-indent: -99999px;
|
||||||
|
position: fixed; bottom: 40px; right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section{width: 100%; height: auto; background-color: #fdfdfd;}
|
||||||
|
.section .cont-wrap{width: 100%; padding: 40px; box-sizing: border-box; max-width: 1300px; margin:0 auto;}
|
||||||
|
|
||||||
|
.notice-tb{width: 100%; table-layout: fixed;}
|
||||||
|
.notice-tb th, .notice-tb td{padding: 15px 30px;}
|
||||||
|
.notice-wrap{padding-bottom: 20px; box-sizing: border-box;}
|
||||||
|
.notice-txt p{font-size: 18px; color:#2b3a58;}
|
||||||
|
.notice-txt p::before{
|
||||||
|
content: ""; display: inline-block; width: 60px; height: 50px;
|
||||||
|
vertical-align: middle; background: url(../img/notice.png) no-repeat; background-size: contain;
|
||||||
|
}
|
||||||
|
.notice{padding-bottom: 20px; }
|
||||||
|
.notice p{padding-bottom: 8px; font-size: 16px; font-weight: bold;}
|
||||||
|
.notice img{width: 24px; vertical-align: text-bottom; padding-right: 5px;}
|
||||||
|
.notice span{font-size: 15px; display: block; padding: 5px;}
|
||||||
|
.notice span::before{content: "-"; display: inline-block; width: 14px;}
|
||||||
|
.notice-a p{color: #005DA6;}
|
||||||
|
.notice-h p{color: #fb843f;}
|
||||||
|
|
||||||
|
.notice-pdf img{width: 20px; padding: 0 10px 0 2px;}
|
||||||
|
.notice-pdf p{color: #444;}
|
||||||
|
.notice-pdf a:hover{text-decoration: underline; color: #0f6fb9;}
|
||||||
|
|
||||||
|
.origin-exam{font-size: 14px; color: #666; text-align: right;}
|
||||||
|
.origin-exam a:hover{text-decoration: underline; color: #0f6fb9;}
|
||||||
|
|
||||||
|
/* (공통)목록 table */
|
||||||
|
.list-tb{counter-reset: tr 0;}
|
||||||
|
.list-tb tr td:first-child::before{counter-increment: tr 1; content:counter(tr) '';}
|
||||||
|
.list-tb{width: 100%; table-layout: fixed; border-top: 2px solid #539426; margin: 20px 0 50px; font-size: 15px;}
|
||||||
|
.list-tb th, .list-tb td{border-right: 1px solid #cecece; text-align: center; padding:12px 18px; line-height: 24px; vertical-align:middle; background-color: #fff; word-break:break-all;}
|
||||||
|
.list-tb th:last-child, .list-tb td:last-child{border:none;}
|
||||||
|
.list-tb th{background-color: #eff4e5; font-size: 16px; color: #333; font-weight: bold;}
|
||||||
|
.list-tb td.ta_l{text-align: left;}
|
||||||
|
.list-tb td.ta_r{text-align: right;}
|
||||||
|
.list-tb td p{font-size: 16px;}
|
||||||
|
.list-tb td > img{width: 24px; padding: 0 5px; vertical-align: middle;}
|
||||||
|
.list-tb td a:hover{ text-decoration:underline;}
|
||||||
|
.list-tb tr{border-bottom: 1px solid #cecece;}
|
||||||
|
.list-tb tr:last-child{border-bottom: 2px solid #2b3a58;}
|
||||||
|
|
||||||
|
.refer{color: #999; font-size: 14px;}
|
||||||
|
|
||||||
|
.exam-link{border-radius: 5px; }
|
||||||
|
.exam-link::before{content: ""; display: inline-block; width: 22px; height: 18px;
|
||||||
|
vertical-align: middle; background: url(../img/code.png) no-repeat; background-size: contain;}
|
||||||
|
.exam-link:hover{color: #0f6fb9;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../innorix.css">
<script src="../innorix.js"></script>
<script>
var control = new Object();
window.onload = function() {
// 파일전송 컨트롤 생성
control = innorix.create({
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
installUrl: '../install/install.html' // Agent 설치 페이지
});
control.on('loadComplete', function (p) { // 다운로드 파일 추가
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
control.presetDownloadFiles(
[{
printFileName: "INNORIX WP 브로셔.pdf",
fileSize: 1433885,
downloadUrl: urlBase + "download.jsp?fileID=1"
},
{
printFileName: "INNORIX WP Brochure.pdf",
fileSize: 1433885,
downloadUrl: urlBase + "download.jsp?fileID=2"
},
{
printFileName: "INNORIX WP パンフレット.pdf",
fileSize: 1433885,
downloadUrl: urlBase + "download.jsp?fileID=3"
}]);
});
// 더블클릭 시
control.on('onDblClickRows', function (file) {
control.downloadAndOpen(file); // 다운로드 완료 후 파일 열기
});
/*
downloadAndOpen (※ Agent 모드 전용 옵션)
- 다운로드 되는 경로 C:\Users\{사용자}\AppData(숨김폴더)\Local\Temp\{난수}
- n개를 선택 후 downloadAndOpen 실행 시 선택한 파일들 중 인덱스 숫자가 큰 파일이 열리게 됩니다.
*/
// 다운로드 완료
control.on('downloadComplete', function (p) {
console.log('download done');
});
};
</script>
</head>
<body>
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
<div id="fileControl"></div><br/>
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
<input type="button" value="전체 다운로드" onclick="control.download();"/>
<input type="button" value="n개선택 후 downloadAndOpen" onclick="control.downloadAndOpen();"/>
</body>
</html>
|
||||||
57
src/main/webapp/innorix/gnexam/debugDropZone.html
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp', // 업로드 URL
|
||||||
|
|
||||||
|
isDebugDropZone: true //드랍존 영역 표시
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
isDebugDropZone (※ Agent 모드 전용 옵션)
|
||||||
|
- true (파일을 드랍존으로 드래그하면 드랍존이 검은색으로 표시)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
<p>설정된 드랍존 영역을 확인하는 방법 - 파일을 드래그하여 드랍존 영역을 확인할 수 있습니다.<p>
|
||||||
|
|
||||||
|
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
71
src/main/webapp/innorix/gnexam/deleteFileInfo.html
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="http://code.jquery.com/jquery-latest.min.js" charset="UTF-8"></script>
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
var fileArray = new Array();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
uploadUrl: './upload.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
|
||||||
|
$('#f_write').submit(); // deleteServer.jsp로 넘어가 삭제된 파일정보가 보여집니다.
|
||||||
|
|
||||||
|
/*innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
innoJquery('form#f_write').submit();*/
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 선택삭제
|
||||||
|
function deleteTest(){
|
||||||
|
var fileInfo = control.getSelectedFiles(); //선택된파일 정보
|
||||||
|
var arrId = new Array();
|
||||||
|
var arrName = new Array();
|
||||||
|
var arrSize = new Array();
|
||||||
|
for(var i=0; i<fileInfo.length; i++){
|
||||||
|
arrId.push(fileInfo[i].id);
|
||||||
|
arrName.push(fileInfo[i].printFileName);
|
||||||
|
arrSize.push(fileInfo[i].fileSize);
|
||||||
|
$('#f_write').append('<input type="hidden" name="_innorix_deleted_id" id="_innorix_deleted_id" value=\'' + arrId[i] + '\' />');
|
||||||
|
$('#f_write').append('<input type="hidden" name="_innorix_deleted_name" id="_innorix_deleted_name" value=\'' + arrName[i] + '\' />');
|
||||||
|
$('#f_write').append('<input type="hidden" name="_innorix_deleted_size" id="_innorix_deleted_size" value=\'' + arrSize[i] + '\' />');
|
||||||
|
}
|
||||||
|
control.removeSelectedFiles(); //선택된파일삭제
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
<p>삭제한 파일정보를 서버에 출력 - 삭제한 파일정보를 확인할 수 있습니다. 선택삭제 후 업로드를 진행해주세요.</p>
|
||||||
|
|
||||||
|
<form action="./deleteServer.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
<input type="button" value="선택삭제" onclick="deleteTest();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
19
src/main/webapp/innorix/gnexam/deleteServer.jsp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||||
|
<%@page import="java.io.File" %>
|
||||||
|
<%
|
||||||
|
request.setCharacterEncoding("UTF-8");
|
||||||
|
String[] strDeletedID = request.getParameterValues("_innorix_deleted_id"); // 삭제된 파일ID
|
||||||
|
String[] strDeletedName = request.getParameterValues("_innorix_deleted_name"); // 삭제된 파일이름
|
||||||
|
String[] strDeletedSize = request.getParameterValues("_innorix_deleted_size"); // 삭제된 파일용량
|
||||||
|
for(int i=0; i<strDeletedID.length; i++){
|
||||||
|
System.out.println("삭제된 "+i+"번째 id= "+strDeletedID[i]);
|
||||||
|
System.out.println("삭제된 "+i+"번째 name= "+strDeletedName[i]);
|
||||||
|
System.out.println("삭제된 "+i+"번째 size= "+strDeletedSize[i]);
|
||||||
|
|
||||||
|
out.println("삭제된 " + i + "번째 id= " + strDeletedID[i] + "<br />");
|
||||||
|
out.println("삭제된 " + i + "번째 name= " + strDeletedName[i] + "<br />");
|
||||||
|
out.println("삭제된 " + i + "번째 size= " + strDeletedSize[i] + "<br />");
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
88
src/main/webapp/innorix/gnexam/download.html
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
innorix.setLanguage('ko');
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html' // Agent 설치 페이지
|
||||||
|
});
|
||||||
|
|
||||||
|
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||||
|
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||||
|
control.presetDownloadFiles(
|
||||||
|
[{
|
||||||
|
printFileName: "INNORIX WP 브로셔.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP Brochure.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP パンフレット.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
|
||||||
|
control.on('downloadComplete', function (p) { // 다운로드 완료
|
||||||
|
console.log(p);
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
console.log(control.getDownloadFiles());
|
||||||
|
var r = "";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].filePath;
|
||||||
|
}
|
||||||
|
console.log(r);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
control.on('onDblClickRows', function(p) { // onSelectRows파일선택시
|
||||||
|
control.downloadAndOpen();
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function getFileCount(){
|
||||||
|
var fileCount = control.getFileCount();
|
||||||
|
alert("allFileCount" + "\n" + fileCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
//n건 선택 후 downloadAndOpen()
|
||||||
|
function downOpen(){
|
||||||
|
var fileInfos = control.getSelectedFiles();
|
||||||
|
console.log(fileInfos);
|
||||||
|
control.unselectAllFiles();
|
||||||
|
|
||||||
|
for (var i=0; i<fileInfos.length; i++) {
|
||||||
|
control.addSelectFilesById(fileInfos[i].rowID);
|
||||||
|
control.downloadAndOpen();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||||
|
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||||
|
<input type="button" value="getFileCount" onClick="getFileCount();"/>
|
||||||
|
<input type="button" value="실행" onclick="downOpen();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
143
src/main/webapp/innorix/gnexam/download.jsp
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||||
|
<%@ page import="java.io.*" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
out.clear();
|
||||||
|
out = pageContext.pushBody();
|
||||||
|
|
||||||
|
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||||
|
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
filePath
|
||||||
|
파일이 저장된 스토리지 전체경로
|
||||||
|
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||||
|
윈도우 - C:/storage/path1/path2/data
|
||||||
|
유닉스 - /storage/path1/path2/data
|
||||||
|
*/
|
||||||
|
|
||||||
|
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||||
|
String szStartOffset = request.getParameter("_StartOffset");
|
||||||
|
String szEndOffset = request.getParameter("_EndOffset");
|
||||||
|
|
||||||
|
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||||
|
String fileID = request.getParameter("fileID");
|
||||||
|
String fileName = request.getParameter("fileName");
|
||||||
|
String sysFileName = new String();
|
||||||
|
String orgFileName = new String();
|
||||||
|
|
||||||
|
if (fileID != null) {
|
||||||
|
if (fileID.equals("1")) {
|
||||||
|
sysFileName = "sample-file.pdf"; // 시스템 저장 파일명
|
||||||
|
orgFileName = "INNORIX WP 브로셔.pdf"; // 원본 파일명
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileID.equals("2")) {
|
||||||
|
sysFileName = "sample-file.pdf";
|
||||||
|
orgFileName = "INNORIX WP Brochure.pdf";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileID.equals("3")) {
|
||||||
|
sysFileName = "sample-file.pdf";
|
||||||
|
orgFileName = "INNORIX WP パンフレット.pdf";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileName != null) {
|
||||||
|
sysFileName = "data/" + fileName;
|
||||||
|
orgFileName = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||||
|
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
|
||||||
|
File file = new File(filePath + sysFileName);
|
||||||
|
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setHeader("Accept-Ranges", "bytes");
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||||
|
|
||||||
|
long startOffset = 0;
|
||||||
|
long endOffset = 0;
|
||||||
|
|
||||||
|
if (szStartOffset != null) {
|
||||||
|
startOffset = Long.parseLong(szStartOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (szEndOffset != null) {
|
||||||
|
endOffset = Long.parseLong(szEndOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
long contentLength = 0;
|
||||||
|
|
||||||
|
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||||
|
contentLength = endOffset - startOffset + 1;
|
||||||
|
} else { // html 일반 다운로드 요청시
|
||||||
|
contentLength = file.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
response.setHeader("Content-Length", "" + contentLength);
|
||||||
|
|
||||||
|
byte b[] = new byte[8192];
|
||||||
|
BufferedInputStream input = null;
|
||||||
|
BufferedOutputStream output = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
input = new BufferedInputStream(new FileInputStream(file));
|
||||||
|
output = new BufferedOutputStream(response.getOutputStream());
|
||||||
|
|
||||||
|
int read = 0;
|
||||||
|
|
||||||
|
if (startOffset != 0) {
|
||||||
|
long n = input.skip(startOffset);
|
||||||
|
if (n == -1) read = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(contentLength > 0) {
|
||||||
|
while (contentLength > 0) {
|
||||||
|
if(contentLength < 8192) {
|
||||||
|
b = new byte[(int)contentLength];
|
||||||
|
}
|
||||||
|
|
||||||
|
read = input.read(b);
|
||||||
|
|
||||||
|
if(read == -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
output.write(b, 0, read);
|
||||||
|
contentLength = contentLength - read;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("fileID \t: " + fileID);
|
||||||
|
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||||
|
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||||
|
System.out.println("totalLength \t: " + file.length() );
|
||||||
|
System.out.println("startOffset \t: " + startOffset);
|
||||||
|
System.out.println("endOffset \t: " + endOffset);
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if(output != null) {
|
||||||
|
output.flush();
|
||||||
|
output.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(input != null) {
|
||||||
|
input.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
|
||||||
|
<%!
|
||||||
|
private String delimiterReplace(String fullDir)
|
||||||
|
{
|
||||||
|
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||||
|
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||||
|
|
||||||
|
return ret2;
|
||||||
|
}
|
||||||
|
%>
|
||||||
@ -0,0 +1,76 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||||
|
pageEncoding="UTF-8"%>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
innorix.setLanguage('ko');
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './uploadSession.jsp', // 업로드 URL
|
||||||
|
agent: false
|
||||||
|
});
|
||||||
|
|
||||||
|
// 로딩 완료
|
||||||
|
control.on('loadComplete', function (p) {
|
||||||
|
control.setCookie("JSESSIONID=<%=session.getId()%>"); //Agent모드 시 세션 유지
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
alert("업로드가 완료 되었습니다.\n다운로드 가능하게 재구성 합니다.");
|
||||||
|
console.log(p);
|
||||||
|
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||||
|
var fileArray = new Array();
|
||||||
|
var f = p.files;
|
||||||
|
|
||||||
|
console.log(p.uniqueId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
console.log(f[i].uniqueId);
|
||||||
|
var fileObj = new Object();
|
||||||
|
fileObj.printFileName = f[i].clientFileName;
|
||||||
|
fileObj.fileSize = f[i].fileSize;
|
||||||
|
fileObj.downloadUrl = urlBase + "downloadDeleteSession.jsp?uniqueId=" + f[i].uniqueId + "&fileName=" + f[i].clientFileName;
|
||||||
|
fileObj.serverFilePath = f[i].serverFilePath;
|
||||||
|
fileObj.rootName = f[i].rootName;
|
||||||
|
fileArray.push(fileObj);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
control.removeAllFiles(); // 리스트 컨트롤에서 파일을 삭제
|
||||||
|
control.presetDownloadFiles(fileArray); // 다운로드 목록을 구성
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="폴더추가" onclick="control.openFolderDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
<input type="button" value="선택파일 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||||
|
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
75
src/main/webapp/innorix/gnexam/downloadCustomError.html
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
innorix.setLanguage('ko'); // 한/영설정 [en,ko]
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
agent : true, // Agent 모드 사용
|
||||||
|
|
||||||
|
retryCount: 1, // 재전송 횟수
|
||||||
|
retryDelay: 1, // 재전송 간격(sec)
|
||||||
|
maximumErrorCount: 0 // 최대 에러 허용 횟수
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
파일 전송 간 오류 발생 시 재전송 시도 횟수 및 간격에 대한 설정을 해줍니다.
|
||||||
|
미설정 시 무제한으로 재전송을 시도하게 됩니다.
|
||||||
|
- 관련 예제 [오류 시 전송 시도 횟수]참고
|
||||||
|
*/
|
||||||
|
|
||||||
|
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||||
|
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||||
|
|
||||||
|
control.presetDownloadFiles(
|
||||||
|
[{
|
||||||
|
printFileName: "INNORIX WP 브로셔.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "downloadCustomError.jsp?fileID=1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP Brochure.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "downloadCustomError.jsp?fileID=2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP パンフレット.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "downloadCustomError.jsp?fileID=3"
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
|
||||||
|
//다운로드 에러 이벤트 (※ Agent 모드 전용)
|
||||||
|
control.on('downloadError', function (p) {
|
||||||
|
control.closeTransferWindow(); //전송창 바로 닫힘
|
||||||
|
|
||||||
|
console.log(p);
|
||||||
|
|
||||||
|
console.log('---- Download Error Event ----');
|
||||||
|
var f = p.files;
|
||||||
|
for(var i=0; i<f.length; i++){
|
||||||
|
console.log("fileName:" + f[i].fileName);
|
||||||
|
console.log("errorCode:" + f[i].errorCode);
|
||||||
|
console.log("errorMessage:" + f[i].errorMessage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||||
|
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
156
src/main/webapp/innorix/gnexam/downloadCustomError.jsp
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%-- <%@ page import="com.innorix.transfer.InnorixCustomError"%> --%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||||
|
<%@ page import="java.io.*" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||||
|
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
filePath
|
||||||
|
파일이 저장된 스토리지 전체경로
|
||||||
|
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||||
|
윈도우 - C:/storage/path1/path2/data
|
||||||
|
유닉스 - /storage/path1/path2/data
|
||||||
|
*/
|
||||||
|
|
||||||
|
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||||
|
String szStartOffset = request.getParameter("_StartOffset");
|
||||||
|
String szEndOffset = request.getParameter("_EndOffset");
|
||||||
|
|
||||||
|
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||||
|
String fileID = request.getParameter("fileID");
|
||||||
|
String fileName = request.getParameter("fileName");
|
||||||
|
String sysFileName = new String();
|
||||||
|
String orgFileName = new String();
|
||||||
|
|
||||||
|
if (fileID != null) {
|
||||||
|
if (fileID.equals("1")) {
|
||||||
|
sysFileName = "sample-file.pdf"; // 시스템 저장 파일명
|
||||||
|
orgFileName = "INNORIX WP 브로셔.pdf"; // 원본 파일명
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileID.equals("2")) {
|
||||||
|
sysFileName = "sample-file.pdf";
|
||||||
|
orgFileName = "INNORIX WP Brochure.pdf";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileID.equals("3")) {
|
||||||
|
sysFileName = "sample-file.pdf";
|
||||||
|
orgFileName = "INNORIX WP パンフレット.pdf";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileName != null) {
|
||||||
|
sysFileName = "data/" + fileName;
|
||||||
|
orgFileName = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||||
|
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
|
||||||
|
//File file = new File(filePath + sysFileName);
|
||||||
|
File file = new File("missingFile.txt"); // 예제 구현을 위한 오류 발생 !!!
|
||||||
|
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setHeader("Accept-Ranges", "bytes");
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||||
|
|
||||||
|
long startOffset = 0;
|
||||||
|
long endOffset = 0;
|
||||||
|
|
||||||
|
if (szStartOffset != null) {
|
||||||
|
startOffset = Long.parseLong(szStartOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (szEndOffset != null) {
|
||||||
|
endOffset = Long.parseLong(szEndOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
long contentLength = 0;
|
||||||
|
|
||||||
|
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||||
|
contentLength = endOffset - startOffset + 1;
|
||||||
|
} else { // html 일반 다운로드 요청시
|
||||||
|
contentLength = file.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 예제 구현을 위한 오류 발생 !!!
|
||||||
|
// response.setHeader("Content-Length", "" + contentLength);
|
||||||
|
|
||||||
|
byte b[] = new byte[8192];
|
||||||
|
BufferedInputStream input = null;
|
||||||
|
BufferedOutputStream output = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
out.clear();
|
||||||
|
out=pageContext.pushBody();
|
||||||
|
|
||||||
|
input = new BufferedInputStream(new FileInputStream(file));
|
||||||
|
output = new BufferedOutputStream(response.getOutputStream());
|
||||||
|
|
||||||
|
int read = 0;
|
||||||
|
|
||||||
|
if (startOffset != 0) {
|
||||||
|
long n = input.skip(startOffset);
|
||||||
|
if (n == -1) read = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(contentLength > 0) {
|
||||||
|
while (contentLength > 0) {
|
||||||
|
if(contentLength < 8192) {
|
||||||
|
b = new byte[(int)contentLength];
|
||||||
|
}
|
||||||
|
|
||||||
|
read = input.read(b);
|
||||||
|
|
||||||
|
if(read == -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
output.write(b, 0, read);
|
||||||
|
contentLength = contentLength - read;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("fileID \t: " + fileID);
|
||||||
|
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||||
|
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||||
|
System.out.println("totalLength \t: " + file.length() );
|
||||||
|
System.out.println("startOffset \t: " + startOffset);
|
||||||
|
System.out.println("endOffset \t: " + endOffset);
|
||||||
|
} catch(Exception e) {
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
/*
|
||||||
|
downloadCustomError
|
||||||
|
에러코드, 에러메시지 설정
|
||||||
|
서버에서 예외상황 발생 시 response에 2000번대 이상의 커스텀 코드와 에러 메시지를 write 해줍니다.
|
||||||
|
*/
|
||||||
|
response.setStatus(2000); //2000번대 이상 커스텀 에러 코드
|
||||||
|
response.getWriter().write("에러메시지 입니다"); // 에러메시지
|
||||||
|
response.getWriter().flush();
|
||||||
|
response.getWriter().close();
|
||||||
|
} finally {
|
||||||
|
if(output != null) {
|
||||||
|
output.flush();
|
||||||
|
output.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(input != null) {
|
||||||
|
input.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
|
||||||
|
<%!
|
||||||
|
private String delimiterReplace(String fullDir)
|
||||||
|
{
|
||||||
|
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||||
|
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||||
|
|
||||||
|
return ret2;
|
||||||
|
}
|
||||||
|
%>
|
||||||
55
src/main/webapp/innorix/gnexam/downloadDelay.html
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
|
||||||
|
downloadDelay: 1000 // ms 단위 다운로드 딜레이 설정 | 기본 : 200
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
downloadDelay
|
||||||
|
- 다운로드 딜레이 설정 (기본값 : 0.2초)
|
||||||
|
빠르고 반복되게 다운로드 요청이 이루어질 때, 브라우저 자체에서 악성 접근으로 감지하여
|
||||||
|
차단되어 다운로드가 정상적으로 진행되지 않을 수 있습니다.
|
||||||
|
해당 경우 downloadDelay 옵션을 통해 딜레이 시간을 보다 길게 설정하여 조치할 수 있습니다.
|
||||||
|
*/
|
||||||
|
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||||
|
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||||
|
control.presetDownloadFiles(
|
||||||
|
[{
|
||||||
|
printFileName: "INNORIX WP 브로셔.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP Brochure.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP パンフレット.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||||
|
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
172
src/main/webapp/innorix/gnexam/downloadDeleteSession.jsp
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@page import="com.innorix.transfer.InnorixCustomValue"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixTransfer" %>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||||
|
<%@ page import="org.json.JSONArray" %>
|
||||||
|
<%@ page import="org.json.JSONObject" %>
|
||||||
|
<%@ page import="java.io.*" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
request.setCharacterEncoding("utf-8");
|
||||||
|
|
||||||
|
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||||
|
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||||
|
/*
|
||||||
|
filePath
|
||||||
|
파일이 저장된 스토리지 전체경로
|
||||||
|
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||||
|
윈도우 - C:/storage/path1/path2/data
|
||||||
|
유닉스 - /storage/path1/path2/data
|
||||||
|
*/
|
||||||
|
|
||||||
|
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||||
|
String szStartOffset = request.getParameter("_StartOffset");
|
||||||
|
String szEndOffset = request.getParameter("_EndOffset");
|
||||||
|
|
||||||
|
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||||
|
String getuniqueId = request.getParameter("uniqueId"); //유니크 아이디
|
||||||
|
String fileName = request.getParameter("fileName");
|
||||||
|
|
||||||
|
String html5 = request.getParameter("_Html5");
|
||||||
|
|
||||||
|
String sysFileName = new String();
|
||||||
|
String orgFileName = new String();
|
||||||
|
|
||||||
|
String fileFullPath = (String)session.getAttribute(getuniqueId); //파일 절대 경로 취득
|
||||||
|
session.setAttribute(getuniqueId, fileFullPath);
|
||||||
|
|
||||||
|
if (fileName != null) {
|
||||||
|
orgFileName = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = null;
|
||||||
|
|
||||||
|
if (fileFullPath != null){
|
||||||
|
file = new File(fileFullPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||||
|
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setHeader("Accept-Ranges", "bytes");
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||||
|
|
||||||
|
long startOffset = 0;
|
||||||
|
long endOffset = 0;
|
||||||
|
|
||||||
|
if (szStartOffset != null) {
|
||||||
|
startOffset = Long.parseLong(szStartOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (szEndOffset != null) {
|
||||||
|
endOffset = Long.parseLong(szEndOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
long contentLength = 0;
|
||||||
|
|
||||||
|
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||||
|
contentLength = endOffset - startOffset + 1;
|
||||||
|
} else { // html 일반 다운로드 요청시
|
||||||
|
contentLength = file.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
response.setHeader("Content-Length", "" + contentLength);
|
||||||
|
|
||||||
|
byte b[] = new byte[8192];
|
||||||
|
BufferedInputStream input = null;
|
||||||
|
BufferedOutputStream output = null;
|
||||||
|
try {
|
||||||
|
out.clear();
|
||||||
|
out=pageContext.pushBody();
|
||||||
|
input = new BufferedInputStream(new FileInputStream(file));
|
||||||
|
output = new BufferedOutputStream(response.getOutputStream());
|
||||||
|
|
||||||
|
int read = 0;
|
||||||
|
|
||||||
|
if (startOffset != 0) {
|
||||||
|
long n = input.skip(startOffset);
|
||||||
|
if (n == -1) read = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(contentLength > 0) {
|
||||||
|
while (contentLength > 0) {
|
||||||
|
if(contentLength < 8192) {
|
||||||
|
b = new byte[(int)contentLength];
|
||||||
|
}
|
||||||
|
|
||||||
|
read = input.read(b);
|
||||||
|
|
||||||
|
if(read == -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
output.write(b, 0, read);
|
||||||
|
contentLength = contentLength - read;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("uniqueId \t: " + getuniqueId);
|
||||||
|
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||||
|
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||||
|
System.out.println("totalLength \t: " + file.length() );
|
||||||
|
System.out.println("startOffset \t: " + startOffset);
|
||||||
|
System.out.println("endOffset \t: " + endOffset);
|
||||||
|
System.out.println("_Html5 \t : " + html5);
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if(output != null) {
|
||||||
|
|
||||||
|
output.flush();
|
||||||
|
output.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(input != null) {
|
||||||
|
input.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if("true".equals(html5)){ //html5 모드 일때
|
||||||
|
session.removeAttribute(getuniqueId); //세션 삭제
|
||||||
|
File f = new File(fileFullPath); //파일 경로
|
||||||
|
System.out.println(f);
|
||||||
|
if(f.exists()){
|
||||||
|
if(f.delete()){
|
||||||
|
System.out.println("파일삭제 성공");
|
||||||
|
|
||||||
|
}else{
|
||||||
|
System.out.println("파일삭제 실패");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
System.out.println("파일 없음");
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{ //Agent 모드 일때
|
||||||
|
session.removeAttribute(getuniqueId);
|
||||||
|
File f = new File(fileFullPath);
|
||||||
|
System.out.println(f);
|
||||||
|
if(f.exists()){
|
||||||
|
if(f.delete()){
|
||||||
|
System.out.println("파일삭제 성공");
|
||||||
|
}else{
|
||||||
|
System.out.println("파일삭제 실패");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
System.out.println("파일 없음");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
%>
|
||||||
|
|
||||||
|
<%!
|
||||||
|
private String delimiterReplace(String fullDir)
|
||||||
|
{
|
||||||
|
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||||
|
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||||
|
|
||||||
|
return ret2;
|
||||||
|
}
|
||||||
|
%>
|
||||||
54
src/main/webapp/innorix/gnexam/downloadIntegrity.html
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
|
||||||
|
downloadIntegrity: true // 다운로드 이중 무결성
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
downloadIntegrity (※ Agent 모드 전용 옵션)
|
||||||
|
- 이중 무결성 로직을 추가하지 않았을 경우에 비해 다운로드 속도가 저하됩니다.
|
||||||
|
*/
|
||||||
|
|
||||||
|
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||||
|
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||||
|
control.presetDownloadFiles(
|
||||||
|
[{
|
||||||
|
printFileName: "INNORIX WP 브로셔.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "downloadIntegrity.jsp?fileID=1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP Brochure.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "downloadIntegrity.jsp?fileID=2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP パンフレット.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "downloadIntegrity.jsp?fileID=3"
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||||
|
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
173
src/main/webapp/innorix/gnexam/downloadIntegrity.jsp
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||||
|
<%-- 1. Integrity 패키지 추가 --%>
|
||||||
|
<%@ page import="com.innorix.integrity.Integrity" %>
|
||||||
|
<%@ page import="java.io.*" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||||
|
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
filePath
|
||||||
|
파일이 저장된 스토리지 전체경로
|
||||||
|
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||||
|
윈도우 - C:/storage/path1/path2/data
|
||||||
|
유닉스 - /storage/path1/path2/data
|
||||||
|
*/
|
||||||
|
|
||||||
|
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||||
|
String szStartOffset = request.getParameter("_StartOffset");
|
||||||
|
String szEndOffset = request.getParameter("_EndOffset");
|
||||||
|
|
||||||
|
String szIntegrity = request.getParameter("_Integrity"); // 파라미터를 통해 이중 무결성 여부 확인
|
||||||
|
|
||||||
|
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||||
|
String fileID = request.getParameter("fileID");
|
||||||
|
String fileName = request.getParameter("fileName");
|
||||||
|
String sysFileName = new String();
|
||||||
|
String orgFileName = new String();
|
||||||
|
|
||||||
|
/*
|
||||||
|
다운로드 이중 무결성 (※ Agent 모드 전용 옵션)
|
||||||
|
_Integity 파라미터를 확인해서 이중 무결성 여부 확인
|
||||||
|
- 이중 무결성 로직을 추가하지 않았을 경우에 비해 다운로드 속도가 저하됩니다.
|
||||||
|
*/
|
||||||
|
boolean isIntegrity = false;
|
||||||
|
if (szIntegrity != null && szIntegrity.equalsIgnoreCase("true")) {
|
||||||
|
isIntegrity = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (fileID != null) {
|
||||||
|
if (fileID.equals("1")) {
|
||||||
|
sysFileName = "sample-file.pdf"; // 시스템 저장 파일명
|
||||||
|
orgFileName = "INNORIX WP 브로셔.pdf"; // 원본 파일명
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileID.equals("2")) {
|
||||||
|
sysFileName = "sample-file.pdf";
|
||||||
|
orgFileName = "INNORIX WP Brochure.pdf";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileID.equals("3")) {
|
||||||
|
sysFileName = "sample-file.pdf";
|
||||||
|
orgFileName = "INNORIX WP パンフレット.pdf";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileName != null) {
|
||||||
|
sysFileName = "data/" + fileName;
|
||||||
|
orgFileName = "data/" + fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
long startOffset = 0;
|
||||||
|
long endOffset = 0;
|
||||||
|
|
||||||
|
if (szStartOffset != null) {
|
||||||
|
startOffset = Long.parseLong(szStartOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (szEndOffset != null) {
|
||||||
|
endOffset = Long.parseLong(szEndOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 응답 데이터 수정
|
||||||
|
if (isIntegrity) {
|
||||||
|
Integrity integrity = new Integrity();
|
||||||
|
String md5 = new String();
|
||||||
|
try {
|
||||||
|
// getMD5FromFileSlice() 메소드 리턴 값을 response에 write 해줍니다.
|
||||||
|
md5 = integrity.getMD5FromFileSlice(filePath + sysFileName, startOffset, endOffset);
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
response.setStatus(200);
|
||||||
|
response.getWriter().write(md5);
|
||||||
|
response.getWriter().flush();
|
||||||
|
response.getWriter().close();
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||||
|
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
|
||||||
|
File file = new File(filePath + sysFileName);
|
||||||
|
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setHeader("Accept-Ranges", "bytes");
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||||
|
|
||||||
|
long contentLength = 0;
|
||||||
|
|
||||||
|
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||||
|
contentLength = endOffset - startOffset + 1;
|
||||||
|
} else { // html 일반 다운로드 요청시
|
||||||
|
contentLength = file.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
response.setHeader("Content-Length", "" + contentLength);
|
||||||
|
|
||||||
|
byte b[] = new byte[8192];
|
||||||
|
BufferedInputStream input = null;
|
||||||
|
BufferedOutputStream output = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
input = new BufferedInputStream(new FileInputStream(file));
|
||||||
|
output = new BufferedOutputStream(response.getOutputStream());
|
||||||
|
|
||||||
|
int read = 0;
|
||||||
|
|
||||||
|
if (startOffset != 0) {
|
||||||
|
long n = input.skip(startOffset);
|
||||||
|
if (n == -1) read = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(contentLength > 0) {
|
||||||
|
while (contentLength > 0) {
|
||||||
|
if(contentLength < 8192) {
|
||||||
|
b = new byte[(int)contentLength];
|
||||||
|
}
|
||||||
|
|
||||||
|
read = input.read(b);
|
||||||
|
|
||||||
|
if(read == -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
output.write(b, 0, read);
|
||||||
|
contentLength = contentLength - read;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("fileID \t: " + fileID);
|
||||||
|
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||||
|
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||||
|
System.out.println("totalLength \t: " + file.length() );
|
||||||
|
System.out.println("startOffset \t: " + startOffset);
|
||||||
|
System.out.println("endOffset \t: " + endOffset);
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if(output != null) {
|
||||||
|
output.flush();
|
||||||
|
output.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(input != null) {
|
||||||
|
input.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
|
||||||
|
<%!
|
||||||
|
private String delimiterReplace(String fullDir)
|
||||||
|
{
|
||||||
|
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||||
|
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||||
|
|
||||||
|
return ret2;
|
||||||
|
}
|
||||||
|
%>
|
||||||
99
src/main/webapp/innorix/gnexam/errorRetryCount.html
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
innorix.setLanguage('ko'); // 한/영설정 [en,ko]
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
transferMode : 'download', // 다운로드 모드 설정
|
||||||
|
agent : true, // Agent 모드 사용
|
||||||
|
|
||||||
|
retryCount: 2, // 재전송 횟수
|
||||||
|
retryDelay: 2, // 재전송 간격(sec)
|
||||||
|
maximumErrorCount: 2 // 최대 에러 허용 횟수
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
오류 발생 시 재전송을 시도할 횟수 설정
|
||||||
|
|
||||||
|
※ retryCount나 retryDelay는 내부에서 처리되는 재시도이기에 별도의 로그 및 이벤트 등으로 캐치 되지 않습니다.
|
||||||
|
|
||||||
|
retryCount (※ Agent 모드 전용 옵션)
|
||||||
|
- 기본값 : 무제한
|
||||||
|
- 전송 내부 쓰레드 재시도 횟수. 지정된 횟수만큼 내부 쓰레드의 재전송을 진행 후, Error로 상태를 반영
|
||||||
|
즉, 전송에 문제가 있을 시 에러라고 판별하기 전까지 진행할 재전송 횟수
|
||||||
|
|
||||||
|
retryDelay (※ Agent 모드 전용 옵션)
|
||||||
|
- 기본값 : 3
|
||||||
|
- 전송 내부 쓰레드 재시도 간격으로, 몇 초마다 재시도 할 것인지를 정의
|
||||||
|
|
||||||
|
maximumErrorCount (※ Agent 모드 전용 옵션)
|
||||||
|
- 기본값 : 무제한
|
||||||
|
- 최대 에러 출력 갯수. retryCount에 따라 재시도 후 에러로 상태기록이 될때 ErrorCount가 1씩 증가
|
||||||
|
|
||||||
|
|
||||||
|
[ 진행 예시 ]
|
||||||
|
전송 ※※ --2초간격--재전송(1회) ※※ --2초간격--재전송(2회) ※※ 에러카운트(1회-downloadError 캐치)
|
||||||
|
전송 ※※ --2초간격--재전송(1회) ※※ --2초간격--재전송(2회) ※※ 에러카운트(2회-downloadError 캐치)
|
||||||
|
전송 ※※ --2초간격--재전송(1회) ※※ --2초간격--재전송(2회) ※※ 에러카운트(3회-downloadError 캐치) => maximumErrorCount 2회를 초과하여 전송중단.
|
||||||
|
|
||||||
|
[ 진행 예시 기호 풀이 ]
|
||||||
|
오류 : ※※
|
||||||
|
retryCount : 재전송(n회)
|
||||||
|
retryDelay : --n초간격--
|
||||||
|
maximumErrorCount : 에러카운트(n회)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||||
|
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||||
|
|
||||||
|
control.presetDownloadFiles(
|
||||||
|
[{
|
||||||
|
printFileName: "INNORIX WP 브로셔.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "downloadErr.jsp?fileID=1" //오류 발생을 위해 downloadErr.jsp(존재하지않는파일)설정
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP Brochure.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "downloadErr.jsp?fileID=2" //오류 발생을 위해 downloadErr.jsp(존재하지않는파일)설정
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP パンフレット.pdf",
|
||||||
|
fileSize: 1433885,
|
||||||
|
downloadUrl: urlBase + "downloadErr.jsp?fileID=3" //오류 발생을 위해 downloadErr.jsp(존재하지않는파일)설정
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
|
||||||
|
//다운로드 에러 이벤트 (Agent 모드 전용)
|
||||||
|
control.on('downloadError', function (p) {
|
||||||
|
console.log(p);
|
||||||
|
|
||||||
|
var f = p.files;
|
||||||
|
for(var i=0; i<f.length; i++){
|
||||||
|
console.log("파일이름: " + f[i].fileName +"\n에러코드: " + f[i].errorCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||||
|
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
49
src/main/webapp/innorix/gnexam/hideServerPathInfo.html
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './hideServerPathInfo.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
//innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
71
src/main/webapp/innorix/gnexam/hideServerPathInfo.jsp
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||||
|
<%-- File import --%>
|
||||||
|
<%@page import="java.io.File"%>
|
||||||
|
|
||||||
|
<%
|
||||||
|
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||||
|
if ("POST".equals(request.getMethod()))
|
||||||
|
{
|
||||||
|
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||||
|
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||||
|
int maxPostSize = 2147482624; // bytes
|
||||||
|
|
||||||
|
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||||
|
|
||||||
|
/*
|
||||||
|
전달되는 _action Param 정보
|
||||||
|
speedCheck : 전송속도 측정
|
||||||
|
getServerInfo : 서버정보 확인
|
||||||
|
getFileInfo : 파일정보 확인
|
||||||
|
attachFile : 파일전송 진행
|
||||||
|
attachFileCompleted : 파일전송 완료
|
||||||
|
*/
|
||||||
|
|
||||||
|
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||||
|
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||||
|
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||||
|
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||||
|
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||||
|
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||||
|
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||||
|
String _el = uploader.getParameter("el"); // 컨트롤 엘리먼트 ID
|
||||||
|
String _type = uploader.getParameter("type"); // 커스텀 정의 POST Param 1
|
||||||
|
String _part = uploader.getParameter("part"); // 커스텀 정의 POST Param 2
|
||||||
|
String _transferId = uploader.getParameter("_transferId"); // TransferId
|
||||||
|
|
||||||
|
/*
|
||||||
|
업로드 간 메타정보 상 노출되는 서버 경로를 숨기기 위한 방법
|
||||||
|
( 업로드 완료 시 클라이언트에 서버에 저장된 파일의 절대 경로가 노출되기 때문에 보안 상 노출이 안 되도록 설정 )
|
||||||
|
uploader.setHideServerPathInfo(true);
|
||||||
|
- uploader.run() 이전에 설정
|
||||||
|
- 해당 설정 시 파일 전송 간 발생되는 통신 구간에서는 서버 경로 정보를 주고 받지 않기 위해
|
||||||
|
InnorixUplaod 클래스를 객체화 할 때 지정해주는 directory 값을 고정으로 업로드하며, setDirectory와 함께 사용할 수 없음
|
||||||
|
*/
|
||||||
|
|
||||||
|
uploader.setHideServerPathInfo(true); //업로드 서버경로 숨김처리
|
||||||
|
String _run_retval = uploader.run();
|
||||||
|
|
||||||
|
// 개별파일 업로드 완료
|
||||||
|
if("attachFileCompleted".equals(_action)) {
|
||||||
|
|
||||||
|
System.out.println("========== uploader.isUploadDone() " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("_orig_filename \t = " + _orig_filename); // 원본 파일명
|
||||||
|
System.out.println("_new_filename \t = " + _new_filename); // 저장 파일명
|
||||||
|
|
||||||
|
/* 업로드 서버 경로 숨김처리 시 저장경로 확인 방법 */
|
||||||
|
System.out.println("_filepath \t = " + _filepath); // 파일 저장경로 (업로드 서버 경로 숨김처리하여 빈값으로 출력)
|
||||||
|
String strDir = uploader.getDirectory(); // 서버에 저장되는 폴더경로
|
||||||
|
System.out.println("strDir \t = " + strDir);
|
||||||
|
String strSrvFilePath = strDir.concat(File.separator).concat(_new_filename);
|
||||||
|
System.out.println("strSrvFilePath \t = " + strSrvFilePath); //서버에 저장된 파일 위치
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// CORS 관련 헤더 추가
|
||||||
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
|
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||||
|
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||||
|
%>
|
||||||
88
src/main/webapp/innorix/gnexam/html5ImageUpload.html
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
innorix.setLanguage('ko');
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'upload', // 업로드, 다운로드 혼합사용
|
||||||
|
agent : false,
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
allowExtension : ["png", "jpg", "jpeg"],
|
||||||
|
showPreviewImage: true, // 이미지 미리보기
|
||||||
|
uploadUrl: './upload.jsp', // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
//innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 파일 선택 시
|
||||||
|
control.on('onSelectRows', function (p) {
|
||||||
|
console.log(p);
|
||||||
|
console.log('---------------------------');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function imageUpload(){
|
||||||
|
control.appendThumbnailProperty("ALL", 300, 300, "FIX");
|
||||||
|
|
||||||
|
control.upload();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
이미지 미리보기
|
||||||
|
- 옵션 : showPreviewImage: true
|
||||||
|
|
||||||
|
- 썸네일 생성(리사이징) : control.appendThumbnailProperty((1), (2), (3), (4));
|
||||||
|
(1) 리사이징을 진행할 원본 이미지 인덱스 Number를 입력해주시거나 ALL을 입력받습니다.
|
||||||
|
ex: control.appendThumnailProperty(1, 300, 300, "VERTICAL");
|
||||||
|
(2) 가로 픽셀 사이즈 (Number)
|
||||||
|
(3) 세로 픽셀 사이즈 (Number)
|
||||||
|
(4) 리사이징을 진행할 가로세로 기준
|
||||||
|
VERTICAL : 세로축 기준 리사이징
|
||||||
|
HORIZONTAL : 가로축 기준 리사이징
|
||||||
|
FIX : 설정한 사이즈에 맞게 리사이징(비율무시)
|
||||||
|
|
||||||
|
- 워터마크 추가
|
||||||
|
(1) 워터마크를 적용할 원본 파일 인덱스 Number를 입력해주시거나 ALL을 입력받습니다.
|
||||||
|
ex : control.appendWatermarkProperty(2, "innorix_logo.png", "LEFT|MIDDLE")
|
||||||
|
(2) 워터마크 이미지 URL
|
||||||
|
(3) 워터마크를 적용할 위치 ("횡축|종축") ("가로|세로")
|
||||||
|
가로 기준 위치 : "LEFT" / "RIGHT" / "CENTER"
|
||||||
|
세로 기준 위치 : "TOP" / "BOTTOM" / "MIDDLE"
|
||||||
|
*/
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="resultImg.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="imageUpload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
15
src/main/webapp/innorix/gnexam/iframe.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script src="../jquery-3.5.1.min.js"></script>
|
||||||
|
<title>Insert title here</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<iframe src="http://localhost:4040/innorix/gnexam0/uploadIframe.html" style="width:600px; height:400px">
|
||||||
|
|
||||||
|
</iframe>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
src/main/webapp/innorix/gnexam/img/agent.png
Normal file
|
After Width: | Height: | Size: 586 B |
BIN
src/main/webapp/innorix/gnexam/img/close-blue.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/main/webapp/innorix/gnexam/img/code.png
Normal file
|
After Width: | Height: | Size: 603 B |
BIN
src/main/webapp/innorix/gnexam/img/dropzone.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
src/main/webapp/innorix/gnexam/img/favicon.ico
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
src/main/webapp/innorix/gnexam/img/gnlogo.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
src/main/webapp/innorix/gnexam/img/gnlogo_w_png.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/main/webapp/innorix/gnexam/img/html5.png
Normal file
|
After Width: | Height: | Size: 441 B |
|
After Width: | Height: | Size: 2.1 KiB |
BIN
src/main/webapp/innorix/gnexam/img/move-blue.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
src/main/webapp/innorix/gnexam/img/notice.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
src/main/webapp/innorix/gnexam/img/pdf.png
Normal file
|
After Width: | Height: | Size: 591 B |
BIN
src/main/webapp/innorix/gnexam/img/top_btn.jpg
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
85
src/main/webapp/innorix/gnexam/installPopup.html
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
innorix.setLanguage('ko');
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
uploadUrl: './upload.jsp', // 업로드 URL
|
||||||
|
installUrl: '../install/install2.html', // Agent 설치 페이지
|
||||||
|
|
||||||
|
installPopupWindow: true, // Agent설치 시 다른 페이지로 이동하지 않고 팝업창으로 띄우기 (※브라우저에서 팝업 허용을 해주어야합니다.)
|
||||||
|
installPopupWindowHeight: 400, // 출력되는 팝업창 높이
|
||||||
|
installPopupWindowWidth: 500, // 출력되는 팝업창 폭
|
||||||
|
installPopupWindowLeft: 100, // 출력되는 팝업창 장축 기준 위치
|
||||||
|
installPopupWindowTop: 50 // 출력되는 팝업창 상단 기준 위치
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
installPopupWindow (※ Agent 모드 전용 옵션)
|
||||||
|
- false (기본값, 기존페이지에서 출력)
|
||||||
|
- true (설치페이지가 팝업으로 출력)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 팝업창 종료시점 감지하기
|
||||||
|
var g_oWindow = null;
|
||||||
|
var g_oInterval = null;
|
||||||
|
var popup = function() {
|
||||||
|
g_oWindow = window.open('http://localhost:8118/innorixjsp/innorix/install/install2.html', 'agent install');
|
||||||
|
// 0.5초 마다 감지
|
||||||
|
g_oInterval = window.setInterval(function() {
|
||||||
|
try {
|
||||||
|
console.log('00000000');
|
||||||
|
// 창이 꺼졌는지 판단
|
||||||
|
if( g_oWindow == null || g_oWindow.closed ) {
|
||||||
|
window.clearInterval(g_oInterval);
|
||||||
|
g_oWindow = null;
|
||||||
|
//opener.parent.location.reload();
|
||||||
|
location.reload();
|
||||||
|
// Todo....
|
||||||
|
//.....
|
||||||
|
alert('창 close');
|
||||||
|
}
|
||||||
|
} catch (e) { }
|
||||||
|
}, 500);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
67
src/main/webapp/innorix/gnexam/isTempFileSize.html
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
|
||||||
|
agent : true // Agent 모드 사용
|
||||||
|
});
|
||||||
|
|
||||||
|
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||||
|
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||||
|
control.presetDownloadFiles(
|
||||||
|
[{
|
||||||
|
printFileName: "INNORIX WP 브로셔.pdf",
|
||||||
|
fileSize: 1433885, // 실제 파일 사이즈
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP Brochure.pdf",
|
||||||
|
fileSize: 143, // 가상의 파일 사이즈
|
||||||
|
isTempFileSize : true,
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP パンフレット.pdf",
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
|
||||||
|
isTempFileSize (※ Agent 모드 전용 옵션)
|
||||||
|
|
||||||
|
- presetDownloadFiles 구성 시 fileSize를 미작성 시 서버의 downloadUrl(download.jsp)에 접속하여 해당 파일의 실제 사이즈를 알아옵니다.
|
||||||
|
실제파일사이즈과 다르게 작성 시 다운로드가 정상적으로 진행되지 않습니다.
|
||||||
|
이때 isTempFileSize 옵션을 통해 가상의 파일사이즈를 작성하여도 정상 다운로드 되게 합니다.
|
||||||
|
(※ fileSize 미작성 시 서버에 접속하여 Request Method "HEAD"에 파일정보가 담겨오게됩니다. 먼저 방화벽에서 해당 메소드허용을 해주어야 합니다.)
|
||||||
|
|
||||||
|
- 선언된 파일 사이즈가 실제 파일 사이즈가 아닌 가상 파일 사이즈임을 선언하는 것으로
|
||||||
|
잘못 입력된 다운로드 fileSize를 무시하고, 요청하는 downloadUrl에서 던져주는 데이터만큼 전송이 진행됩니다.
|
||||||
|
이에 분할 전송이 불가능하며, 고속전송 및 이어받기, 에러 시 중간지점에서부터의 재시도 등 부가기능이 제한됩니다.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
control.on('downloadCancel', function (p) {
|
||||||
|
alert("다운로드가 취소되었습니다.");
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||||
|
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
63
src/main/webapp/innorix/gnexam/postData.html
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
transferMode: 'upload', // 업로드, 다운로드 혼합사용
|
||||||
|
uploadUrl: './postData.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 업로드
|
||||||
|
function upload() {
|
||||||
|
var fileInfo = control.getAllFiles(); // 모든 파일 정보 출력
|
||||||
|
if (fileInfo.length == 0 ) { // 파일 개수가 0 이면 return
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 트랜잭션 별 업로드시 함께 전달될 POST Param 추가
|
||||||
|
var postObj1 = new Object(); // postdata 를 전달할 object 객체 생성
|
||||||
|
var paramVal = "Transection";
|
||||||
|
postObj1.transParam1 = paramVal; // 임의의 텍스트 할당
|
||||||
|
postObj1.transParam2 = fileInfo[0].mode; // 전송모드 할당
|
||||||
|
control.setPostData(postObj1); // 트랜잭션 별 postdata로 값 저장
|
||||||
|
|
||||||
|
|
||||||
|
// 파일 별 업로드시 함께 전달될 POST Param 추가
|
||||||
|
for (i=0; i<fileInfo.length; i++){
|
||||||
|
var postObj2 = new Object(); //파일별 postdata를 전달할 object 객체 생성
|
||||||
|
postObj2.fileParam1 = fileInfo[i].basePath; // 각 파일 index의 basePath 할당
|
||||||
|
postObj2.fileParam2 = fileInfo[i].printFileName; // 각 파일 index의 printFileName 할당
|
||||||
|
control.setFilePostDataByIndex(i, postObj2); // 파일별 postdata로 값 저장
|
||||||
|
}
|
||||||
|
|
||||||
|
control.upload(); // 파일 업로드 시작
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
56
src/main/webapp/innorix/gnexam/postData.jsp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||||
|
if ("POST".equals(request.getMethod()))
|
||||||
|
{
|
||||||
|
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||||
|
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||||
|
int maxPostSize = 2147482624; // bytes
|
||||||
|
|
||||||
|
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||||
|
|
||||||
|
/*
|
||||||
|
전달되는 _action Param 정보
|
||||||
|
speedCheck : 전송속도 측정
|
||||||
|
getServerInfo : 서버정보 확인
|
||||||
|
getFileInfo : 파일정보 확인
|
||||||
|
attachFile : 파일전송 진행
|
||||||
|
attachFileCompleted : 파일전송 완료
|
||||||
|
*/
|
||||||
|
|
||||||
|
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||||
|
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||||
|
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||||
|
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||||
|
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||||
|
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||||
|
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||||
|
String _el = uploader.getParameter("el"); // 컨트롤 엘리먼트 ID
|
||||||
|
|
||||||
|
String fileParam1 = uploader.getParameter("fileParam1"); // 파일 별 커스텀 정의 POST Param 1
|
||||||
|
String fileParam2 = uploader.getParameter("fileParam2"); // 파일 별 커스텀 정의 POST Param 2
|
||||||
|
String transParam1 = uploader.getParameter("transParam1"); // 전송 별 커스텀 정의 POST Param 3
|
||||||
|
String transParam2 = uploader.getParameter("transParam2"); // 전송 별 커스텀 정의 POST Param 4
|
||||||
|
|
||||||
|
String _run_retval = uploader.run();
|
||||||
|
|
||||||
|
// 개별파일 업로드 완료
|
||||||
|
if("attachFileCompleted".equals(_action)) {
|
||||||
|
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("_action \t = " + _action);
|
||||||
|
System.out.println("트랜잭션별 transParam1 : " + transParam1 + ", transParam2 : " + transParam2);
|
||||||
|
System.out.println("파일별 fileParam1 : " + fileParam1 + ", fileParam2 : " + fileParam2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// CORS 관련 헤더 추가
|
||||||
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
|
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||||
|
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||||
|
%>
|
||||||
18
src/main/webapp/innorix/gnexam/result.jsp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<%
|
||||||
|
request.setCharacterEncoding("UTF-8");
|
||||||
|
java.util.Enumeration names = request.getParameterNames();
|
||||||
|
|
||||||
|
while (names.hasMoreElements()) {
|
||||||
|
String name = (String)names.nextElement();
|
||||||
|
String values[] = request.getParameterValues(name);
|
||||||
|
|
||||||
|
if (values != null) {
|
||||||
|
for (int i=0; i< values.length; i++) {
|
||||||
|
System.out.println ( i + ". " + name + " = " + values[i]);
|
||||||
|
out.println ( i + ". " + name + " = " + values[i] + "<br />");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
BIN
src/main/webapp/innorix/gnexam/sample-file.pdf
Normal file
74
src/main/webapp/innorix/gnexam/setLanguage.html
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
/*
|
||||||
|
방법 1 )
|
||||||
|
innorix.setLanguage('ko'); // 한/영설정 [en,ko]
|
||||||
|
*/
|
||||||
|
innorix.setLanguage('ko');
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
progressTitle: '파일 전송 창 제목', // 전송창 타이틀 출력 문구, 기본값 : WP
|
||||||
|
uploadUrl: './upload.jsp' // 업로드 URL
|
||||||
|
|
||||||
|
//, controlLang: 'ko' // 방법 2 ) 한글 출력, 기본값 : en
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
INNORIX WP는 영어 메시지를 기본으로 출력하며 설정을 통해 한글로 출력이 가능하게 됩니다.
|
||||||
|
두 방법 중 선택해서 적용하시면 되겠습니다. 방법 1을 권장드립니다.
|
||||||
|
|
||||||
|
방법 1 ) 컨트롤 생성 전에(innorix.create전에) 선언해주어야 합니다.
|
||||||
|
innorix.setLanguage
|
||||||
|
- innorix.setLanguage('ko'); (한글출력)
|
||||||
|
- innorix.setLanguage('en'); (영문출력)
|
||||||
|
|
||||||
|
방법 2 )
|
||||||
|
controlLang
|
||||||
|
- 'en' (기본값, 영문출력)
|
||||||
|
- 'ko' (한글출력)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
//innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
59
src/main/webapp/innorix/gnexam/showTransferFileStatus.html
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp', // 업로드 URL
|
||||||
|
|
||||||
|
skin : 'compact',
|
||||||
|
showTransferFileStatus : true // 리스트 전송창 모드에서 파일별 전송상태 출력
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
showTransferFileStatus (※ Agent 모드 전용 옵션)
|
||||||
|
- 리스트 전송창 모드에서 파일별 전송상태 출력하기위해서
|
||||||
|
skin : 'compact' , showTransferFileStatus : true 옵션 두가지를 함께 사용해주셔야 합니다.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
//innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
87
src/main/webapp/innorix/gnexam/skipAgentCheck.html
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control1 = new Object(); // 파일전송 컨트롤 1
|
||||||
|
var control2 = new Object(); // 파일전송 컨트롤 2
|
||||||
|
var control3 = new Object(); // 파일전송 컨트롤 3
|
||||||
|
|
||||||
|
function uploadAll() {
|
||||||
|
control3.addFiles(control1.getAllFiles());
|
||||||
|
control3.addFiles(control2.getAllFiles());
|
||||||
|
control3.upload();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control1 = innorix.create({
|
||||||
|
el: '#fileControll', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp?el=fileControll'
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
control2 = innorix.create({
|
||||||
|
el: '#fileControl2',
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
skipAgentCheck : true,
|
||||||
|
uploadUrl: './upload.jsp?el=fileControl2'
|
||||||
|
});
|
||||||
|
|
||||||
|
control3 = innorix.create({
|
||||||
|
el: '#fileControl3',
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
skipAgentCheck : true,
|
||||||
|
uploadUrl: './upload.jsp'
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control1.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
|
||||||
|
control2.on('uploadComplete', function (p) {
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
|
||||||
|
control3.on('uploadComplete', function (p) {
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
<div id="fileControll"></div><br />
|
||||||
|
|
||||||
|
<input type="button" value="파일추가" onclick="control1.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control1.upload();" /><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl2"></div><br />
|
||||||
|
|
||||||
|
<input type="button" value="파일추가" onclick="control2.openFileDialog();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control2.upload();" /><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl3" style="display:none"></div>
|
||||||
|
|
||||||
|
<input type="button" value="전체 업로드" onclick="uploadAll();" />
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
59
src/main/webapp/innorix/gnexam/skipFileSizeCheck.html
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
|
||||||
|
agent : false, // Html5 모드 사용
|
||||||
|
skipFileSizeCheck : true // Html5 모드 사용 시 파일 사이즈 체크 건너 뜀
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
skipFileSizeCheck (※ Html5 모드 전용 옵션)
|
||||||
|
- 입력되지 않았거나 잘못된 FileSize인 경우 downloadUrl로 접속하여 사이즈를 확인하는 과정을 건너뜁니다.
|
||||||
|
*/
|
||||||
|
|
||||||
|
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||||
|
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||||
|
control.presetDownloadFiles(
|
||||||
|
[{
|
||||||
|
printFileName: "INNORIX WP 브로셔.pdf",
|
||||||
|
// 파일 사이즈를 입력하지 않음
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP Brochure.pdf",
|
||||||
|
fileSize: 305, // 잘못된 파일 사이즈를 입력함 (실제사이즈보다 작게)
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
printFileName: "INNORIX WP パンフレット.pdf",
|
||||||
|
fileSize: 2785, // 잘못된 파일 사이즈를 입력함 (실제사이즈보다 크게)
|
||||||
|
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 다운로드 취소
|
||||||
|
control.on('downloadCancel', function (p) {
|
||||||
|
alert("다운로드가 취소되었습니다.");
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||||
|
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
62
src/main/webapp/innorix/gnexam/sliceSizeSession.html
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp', // 업로드 URL
|
||||||
|
|
||||||
|
uploadSliceSize: 2147483648, //2GB 업로드 조각 사이즈
|
||||||
|
downloadSliceSize: 2147483648, //2GB 다운로드 조각 사이즈
|
||||||
|
uploadSessionCount: 1, // 업로드 세션 개수
|
||||||
|
downloadSessionCount: 1 // 다운로드 세션 개수
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
Agent 모드, Html5 모드
|
||||||
|
- 기본 조각 사이즈 2MB, 세션 16개가 적용됩니다.
|
||||||
|
|
||||||
|
이노릭스 에이전트 설치경로(기본경로 C:\INNORIX_Agent)의 property.conf파일 내의
|
||||||
|
"autoSetting" : true 로 작성되어야 해당 옵션이 적용됩니다.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
54
src/main/webapp/innorix/gnexam/transferCancel.html
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload0.jsp' // 업로드 URL ( 에러발생을 위해 잘못된 주소로 설정 )
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadError', function (p) {
|
||||||
|
console.log('---- uploadError! ----');
|
||||||
|
control.transferCancel(); // 진행중인 업로드 취소
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1
src/main/webapp/innorix/gnexam/upDownFolder.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../innorix.css">
<script src="../innorix.js"></script>
<script>
var control = new Object();
window.onload = function() {
// 파일전송 컨트롤 생성
control = innorix.create({
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
transferMode: 'both', // 업로드, 다운로드 혼합사용
installUrl: '../install/install.html', // Agent 설치 페이지
uploadUrl: './upload.jsp', // 업로드 URL
folderIntact: true, // 폴더 첨부
showFolderItems: true, // 폴더 구조의 리스트 출력
showFolderItemsTree: true // 폴더 트리구조의 리스트 출력
});
/*
folderIntact (※ Agent 모드 전용 옵션)
- 폴더첨부유무
showFolderItems (※ Agent 모드 전용 옵션)
- 폴더구조의리스트출력여부
showFolderItemsTree (※ Agent 모드 전용 옵션)
- 폴더트리 구조 리스트 출력 여부
*/
// 업로드 완료 이벤트
control.on('uploadComplete', function (p) {
alert("업로드가 완료 되었습니다.\n다운로드 가능하게 재구성 합니다.");
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
var fileArray = new Array();
var f = p.files;
for (var i = 0; i < f.length; i++ ) {
var fileObj = new Object();
fileObj.printFileName = f[i].clientFileName;
fileObj.fileSize = f[i].fileSize;
console.log('fileObj.rootName : '+f[i].rootName);
//폴더 정보인 rootName과 "/" 추가
fileObj.rootName = f[i].rootName;
fileObj.downloadUrl = urlBase + "upDownFolder.jsp?fileName=" +f[i].rootName+"/"+f[i].serverFileName;
fileArray.push(fileObj);
}
console.log(fileArray);
control.removeAllFiles(); // 리스트 컨트롤에서 파일을 삭제
control.presetDownloadFiles(fileArray); // 다운로드 목록을 구성
});
};
</script>
</head>
<body>
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
<div id="fileControl"></div><br/>
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
<input type="button" value="업로드" onclick="control.upload();"/>
<input type="button" value="폴더추가" onclick="control.openFolderDialog();"/> |
<input type="button" value="선택파일 다운로드" onclick="control.downloadSelectedFiles();"/>
<input type="button" value="전체 다운로드" onclick="control.download();"/>
</body>
</html>
|
||||||
140
src/main/webapp/innorix/gnexam/upDownFolder.jsp
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
<%@page import="com.innorix.transfer.InnorixCustomError"%>
|
||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||||
|
<%@ page import="java.io.*" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
out.clear();
|
||||||
|
out = pageContext.pushBody();
|
||||||
|
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||||
|
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
filePath
|
||||||
|
파일이 저장된 스토리지 전체경로
|
||||||
|
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||||
|
윈도우 - C:/storage/path1/path2/data
|
||||||
|
유닉스 - /storage/path1/path2/data
|
||||||
|
*/
|
||||||
|
|
||||||
|
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||||
|
String szStartOffset = request.getParameter("_StartOffset");
|
||||||
|
String szEndOffset = request.getParameter("_EndOffset");
|
||||||
|
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||||
|
String fileID = request.getParameter("fileID");
|
||||||
|
String fileName = request.getParameter("fileName");
|
||||||
|
String sysFileName = new String();
|
||||||
|
String orgFileName = new String();
|
||||||
|
if (fileID != null) {
|
||||||
|
if (fileID.equals("1")) {
|
||||||
|
sysFileName = "sample-file.pdf"; // 시스템 저장 파일명
|
||||||
|
orgFileName = "INNORIX WP 브로셔.pdf"; // 원본 파일명
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileID.equals("2")) {
|
||||||
|
sysFileName = "sample-file.pdf";
|
||||||
|
orgFileName = "INNORIX WP Brochure.pdf";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileID.equals("3")) {
|
||||||
|
sysFileName = "sample-file.pdf";
|
||||||
|
orgFileName = "INNORIX WP パンフレット.pdf";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileName != null) {
|
||||||
|
sysFileName = "data/" + fileName;
|
||||||
|
orgFileName = "data/" + fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||||
|
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
|
||||||
|
File file = new File(filePath + sysFileName);
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setHeader("Accept-Ranges", "bytes");
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||||
|
|
||||||
|
long startOffset = 0;
|
||||||
|
long endOffset = 0;
|
||||||
|
|
||||||
|
if (szStartOffset != null) {
|
||||||
|
startOffset = Long.parseLong(szStartOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (szEndOffset != null) {
|
||||||
|
endOffset = Long.parseLong(szEndOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
long contentLength = 0;
|
||||||
|
|
||||||
|
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||||
|
contentLength = endOffset - startOffset + 1;
|
||||||
|
} else { // html 일반 다운로드 요청시
|
||||||
|
contentLength = file.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
response.setHeader("Content-Length", "" + contentLength);
|
||||||
|
|
||||||
|
byte b[] = new byte[8192];
|
||||||
|
BufferedInputStream input = null;
|
||||||
|
BufferedOutputStream output = null;
|
||||||
|
try {
|
||||||
|
input = new BufferedInputStream(new FileInputStream(file));
|
||||||
|
output = new BufferedOutputStream(response.getOutputStream());
|
||||||
|
|
||||||
|
int read = 0;
|
||||||
|
|
||||||
|
if (startOffset != 0) {
|
||||||
|
long n = input.skip(startOffset);
|
||||||
|
if (n == -1) read = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(contentLength > 0) {
|
||||||
|
while (contentLength > 0) {
|
||||||
|
if(contentLength < 8192) {
|
||||||
|
b = new byte[(int)contentLength];
|
||||||
|
}
|
||||||
|
|
||||||
|
read = input.read(b);
|
||||||
|
|
||||||
|
if(read == -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
output.write(b, 0, read);
|
||||||
|
contentLength = contentLength - read;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("fileID \t: " + fileID);
|
||||||
|
System.out.println("fileName \t: " + fileName);
|
||||||
|
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||||
|
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||||
|
System.out.println("totalLength \t: " + file.length() );
|
||||||
|
System.out.println("startOffset \t: " + startOffset);
|
||||||
|
System.out.println("endOffset \t: " + endOffset);
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if(output != null) {
|
||||||
|
output.flush();
|
||||||
|
output.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(input != null) {
|
||||||
|
input.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
|
||||||
|
<%!
|
||||||
|
private String delimiterReplace(String fullDir)
|
||||||
|
{
|
||||||
|
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||||
|
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||||
|
|
||||||
|
return ret2;
|
||||||
|
}
|
||||||
|
%>
|
||||||
68
src/main/webapp/innorix/gnexam/upload.jsp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||||
|
if ("POST".equals(request.getMethod()))
|
||||||
|
{
|
||||||
|
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||||
|
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||||
|
int maxPostSize = 2147482624; // bytes
|
||||||
|
|
||||||
|
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||||
|
|
||||||
|
/*
|
||||||
|
전달되는 _action Param 정보
|
||||||
|
speedCheck : 전송속도 측정
|
||||||
|
getServerInfo : 서버정보 확인
|
||||||
|
getFileInfo : 파일정보 확인
|
||||||
|
attachFile : 파일전송 진행
|
||||||
|
attachFileCompleted : 파일전송 완료
|
||||||
|
*/
|
||||||
|
|
||||||
|
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||||
|
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||||
|
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||||
|
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||||
|
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||||
|
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||||
|
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||||
|
String _el = uploader.getParameter("el"); // 컨트롤 엘리먼트 ID
|
||||||
|
String _type = uploader.getParameter("type"); // 커스텀 정의 POST Param 1
|
||||||
|
String _part = uploader.getParameter("part"); // 커스텀 정의 POST Param 2
|
||||||
|
String _transferId = uploader.getParameter("_transferId"); // TransferId
|
||||||
|
String _run_retval = uploader.run();
|
||||||
|
|
||||||
|
// 개별파일 업로드 완료
|
||||||
|
if("attachFileCompleted".equals(_action)) {
|
||||||
|
|
||||||
|
System.out.println("========== uploader.isUploadDone() " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("_orig_filename \t = " + _orig_filename);
|
||||||
|
/*
|
||||||
|
System.out.println("_new_filename \t = " + _new_filename);
|
||||||
|
System.out.println("_filesize \t = " + _filesize);
|
||||||
|
System.out.println("_filepath \t = " + _filepath);
|
||||||
|
System.out.println("_el \t = " + _el);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("_action \t = " + _action);
|
||||||
|
System.out.println("_run_retval \t = " + _run_retval);
|
||||||
|
/* System.out.println("_orig_filename \t = " + _orig_filename);
|
||||||
|
System.out.println("_new_filename \t = " + _new_filename);
|
||||||
|
System.out.println("_filesize \t = " + _filesize);
|
||||||
|
System.out.println("_start_offset \t = " + _start_offset);
|
||||||
|
System.out.println("_end_offset \t = " + _end_offset);
|
||||||
|
System.out.println("_filepath \t = " + _filepath);
|
||||||
|
System.out.println("_el \t = " + _el);
|
||||||
|
System.out.println("_type \t = " + _type);
|
||||||
|
System.out.println("_part \t = " + _part); */
|
||||||
|
}
|
||||||
|
|
||||||
|
// CORS 관련 헤더 추가
|
||||||
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
|
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||||
|
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||||
|
%>
|
||||||
101
src/main/webapp/innorix/gnexam/uploadAddFileError.html
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
limitExtension: ["zip","pdf"], // 정의된 확장자 파일을 제외
|
||||||
|
maxTotalSize: 9000000, //전체파일 사이즈 제한
|
||||||
|
maxFileSize: 2000, //개별파일 사이즈 제한
|
||||||
|
addDuplicateFile: false, //중복파일 추가 제한
|
||||||
|
maxFileCount: 2, //첨부파일 개수 제한
|
||||||
|
uploadUrl: './upload.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 파일 첨부시 에러
|
||||||
|
control.on('addFileError', function (p) {
|
||||||
|
/**
|
||||||
|
A. 개별파일 사이즈 : maxFileSize
|
||||||
|
B. 전체파일 사이즈 : maxTotalSize
|
||||||
|
C. 첨부파일 개수제한 : maxFileCount
|
||||||
|
D. 특정확장자 제외 : limitExtension
|
||||||
|
E. 특정확장자만 추가 : allowExtension
|
||||||
|
F. 중복파일 추가 : addDuplicateFile
|
||||||
|
*/
|
||||||
|
console.log(p); //첨부에 실패한 파일 개수만큼의 인덱스 배열로 리턴
|
||||||
|
console.log(p.length); //첨부에 실패한 파일 개수
|
||||||
|
|
||||||
|
for (var i = 0; i < p.length; i++ ) {
|
||||||
|
console.log(p[i].type); //위반 정책 출력
|
||||||
|
console.log(p[i].message); //위반 시의 기본 메시지 출력 (이노릭스 자체 메세지)
|
||||||
|
console.log(p[i].file); //에러 파일에 대한 상세 정보
|
||||||
|
console.log(p[i].file.fileSize); //파일에대한 상세정보중 필요한 정보 출력 ex) basePath, filePath 등
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
개개별의 에러를 보여줄 필요가 없는 경우,
|
||||||
|
리턴되는 p파라메터의 첫번째 인덱스의 에러 메시지를 바로 출력하는 방식으로 구성이 가능
|
||||||
|
*/
|
||||||
|
console.log(p[0].type);
|
||||||
|
|
||||||
|
//이노릭스 기본메세지가아닌 다른 메세지를 출력할때
|
||||||
|
if(p[0].type == "allowExtension") {
|
||||||
|
alert("확장자 제한");
|
||||||
|
} else if(p[0].type == "maxFileCount") {
|
||||||
|
alert("개수 제한");
|
||||||
|
} else if(p[0].type == "maxTotalSize") {
|
||||||
|
alert("사이즈 제한");
|
||||||
|
} else if(p[0].type == "limitExtension") {
|
||||||
|
alert("확장자 제한");
|
||||||
|
} else if(p[0].type == "addDuplicateFile") {
|
||||||
|
alert("중복파일 제한");
|
||||||
|
} else if(p[0].type == "maxFileSize") {
|
||||||
|
alert("개별파일 사이즈 제한");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
console.log(files);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
// innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
93
src/main/webapp/innorix/gnexam/uploadAddFileError_old.html
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix_373.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
limitExtension: ["zip","pdf"], // 정의된 확장자 파일을 제외
|
||||||
|
maxTotalSize: 9000000, //전체파일 사이즈 제한
|
||||||
|
maxFileSize: 2000, //개별파일 사이즈 제한
|
||||||
|
addDuplicateFile: false, //중복파일 추가 제한
|
||||||
|
maxFileCount: 2, //첨부파일 개수 제한
|
||||||
|
uploadUrl: './upload.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 파일 첨부시 에러
|
||||||
|
control.on('addFileError', function (p) {
|
||||||
|
/**
|
||||||
|
A. 개별파일 사이즈 : maxFileSize
|
||||||
|
B. 전체파일 사이즈 : maxTotalSize
|
||||||
|
C. 첨부파일 개수제한 : maxFileCount
|
||||||
|
D. 특정확장자 제외 : limitExtension
|
||||||
|
E. 특정확장자만 추가 : allowExtension
|
||||||
|
F. 중복파일 추가 : addDuplicateFile
|
||||||
|
*/
|
||||||
|
|
||||||
|
console.log(p); //첨부에 실패한 파일 배열로 리턴
|
||||||
|
console.log(p.type); //위반 정책 출력
|
||||||
|
console.log(p.message); //위반 시의 기본 메시지 출력 (이노릭스 자체 메세지)
|
||||||
|
|
||||||
|
|
||||||
|
var f = p.file;
|
||||||
|
var f2 = p.files;
|
||||||
|
console.log(f); //첨부에 실패한 파일의 정보
|
||||||
|
|
||||||
|
if(p.type == "allowExtension") {
|
||||||
|
alert(f.filePath + "\n확장자 제한");
|
||||||
|
} else if(p.type == "maxFileCount") {
|
||||||
|
alert("개수 제한");
|
||||||
|
} else if(p.type == "maxTotalSize") {
|
||||||
|
alert("사이즈 제한");
|
||||||
|
} else if(p.type == "limitExtension") {
|
||||||
|
alert(f.filePath + "\n확장자 제한");
|
||||||
|
} else if(p.type == "addDuplicateFile") {
|
||||||
|
alert("중복파일 제한");
|
||||||
|
} else if(p.type == "maxFileSize") {
|
||||||
|
alert("개별파일 사이즈 제한");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
console.log(files);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
// innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
75
src/main/webapp/innorix/gnexam/uploadCustomError.html
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
innorix.setLanguage('ko');
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './uploadCustomError.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
//업로드 에러
|
||||||
|
control.on('uploadError', function (p) {
|
||||||
|
control.transferCancel();
|
||||||
|
control.closeTransferWindow(); // 전송창 닫기
|
||||||
|
|
||||||
|
console.log(p);
|
||||||
|
var f = p.files;
|
||||||
|
|
||||||
|
/*
|
||||||
|
메세지를 한번만 출력 시
|
||||||
|
var m = p.statusMessage;
|
||||||
|
console.log("customError : "+m.customError);
|
||||||
|
console.log("errorCode : "+m.errorCode);
|
||||||
|
console.log("id : "+m.id);
|
||||||
|
*/
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
console.log("-------- 서버 커스텀 에러 --------");
|
||||||
|
console.log("에러코드 : "+f[i].errorCode);
|
||||||
|
console.log("에러제목 : "+f[i].errorTitle);
|
||||||
|
console.log("에러내용 : "+f[i].errorMessage);
|
||||||
|
console.log("----------------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
//innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="./result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
72
src/main/webapp/innorix/gnexam/uploadCustomError.jsp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixCustomError" %>
|
||||||
|
<%@ page import="java.util.UUID" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||||
|
if ("POST".equals(request.getMethod()))
|
||||||
|
{
|
||||||
|
try{
|
||||||
|
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||||
|
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||||
|
int maxPostSize = 2147482624; // bytes
|
||||||
|
|
||||||
|
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||||
|
|
||||||
|
/*
|
||||||
|
전달되는 _action Param 정보
|
||||||
|
speedCheck : 전송속도 측정
|
||||||
|
getServerInfo : 서버정보 확인
|
||||||
|
getFileInfo : 파일정보 확인
|
||||||
|
attachFile : 파일전송 진행
|
||||||
|
attachFileCompleted : 파일전송 완료
|
||||||
|
*/
|
||||||
|
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||||
|
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||||
|
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||||
|
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||||
|
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||||
|
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||||
|
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||||
|
String _el = uploader.getParameter("el"); // 컨트롤 엘리먼트 ID
|
||||||
|
|
||||||
|
String _run_retval = uploader.run();
|
||||||
|
|
||||||
|
/*
|
||||||
|
getFileInfo 이후 에러발생부터 uploadError이벤트 파라미터에 파일별로 에러메시지가 출력됨
|
||||||
|
커스텀 에러 사용 시 getFileInfo를 사용 권장
|
||||||
|
*/
|
||||||
|
if("getFileInfo".equals(_action)){
|
||||||
|
// ※※ 임의의 에러 발생 ※※
|
||||||
|
if("test".equals("test")){
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch(Exception e){
|
||||||
|
/*
|
||||||
|
|
||||||
|
커스텀 에러 구성
|
||||||
|
InnorixCustomError (※ Agent 모드 전용 옵션)
|
||||||
|
InnorixCustomError.set(Error Code, Error Message, Error Title, retry);
|
||||||
|
InnorixCustomError.run();
|
||||||
|
|
||||||
|
- Error Code : 1100번대 번호로 사용 권장 (1100번대 이하는 내부적으로 사용하는 코드로 충돌날 수 있음)
|
||||||
|
*/
|
||||||
|
InnorixCustomError customError = new InnorixCustomError(response);
|
||||||
|
customError.set("1234", "Test Error Tit", "Test Error Content", false); //에러코드, 에러제목, 에러내용, 재전송여부
|
||||||
|
customError.run();
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// CORS 관련 헤더 추가
|
||||||
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
|
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||||
|
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||||
|
%>
|
||||||
50
src/main/webapp/innorix/gnexam/uploadCustomValue.html
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './uploadCustomValue.jsp' // 업로드 URL
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += "파일명 : "+ f[i].clientFileName + ", customKey : " + f[i].customKey + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
//innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="./result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
64
src/main/webapp/innorix/gnexam/uploadCustomValue.jsp
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||||
|
<%-- <%@page import="com.innorix.transfer.InnorixCustomValue"%> --%>
|
||||||
|
<%@page import="com.innorix.multipartrequest.MultipartRequest"%>
|
||||||
|
<%@page import="java.io.File"%>
|
||||||
|
|
||||||
|
<%
|
||||||
|
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||||
|
if ("POST".equals(request.getMethod()))
|
||||||
|
{
|
||||||
|
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||||
|
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||||
|
int maxPostSize = 2147482624; // bytes
|
||||||
|
|
||||||
|
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||||
|
/*
|
||||||
|
전달되는 _action Param 정보
|
||||||
|
speedCheck : 전송속도 측정
|
||||||
|
getServerInfo : 서버정보 확인
|
||||||
|
getFileInfo : 파일정보 확인
|
||||||
|
attachFile : 파일전송 진행
|
||||||
|
attachFileCompleted : 파일전송 완료
|
||||||
|
*/
|
||||||
|
|
||||||
|
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||||
|
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||||
|
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||||
|
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||||
|
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||||
|
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||||
|
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||||
|
String _el = uploader.getParameter("el"); // 컨트롤 엘리먼트 ID
|
||||||
|
|
||||||
|
String _run_retval = uploader.run();
|
||||||
|
|
||||||
|
//개별파일 업로드 완료
|
||||||
|
if("attachFileCompleted".equals(_action)){
|
||||||
|
/*
|
||||||
|
커스텀밸류 구성, 전송
|
||||||
|
uploader.setCustomValue(KEY, VALUE);
|
||||||
|
uploader.sendCustomValue();
|
||||||
|
*/
|
||||||
|
uploader.setCustomValue("customKey", "customValue"); // 클라이언트측으로 key,value값 전달
|
||||||
|
uploader.sendCustomValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||||
|
System.out.println("_action \t = " + _action);
|
||||||
|
System.out.println("_run_retval \t = " + _run_retval);
|
||||||
|
System.out.println("_orig_filename \t = " + _orig_filename);
|
||||||
|
System.out.println("_new_filename \t = " + _new_filename);
|
||||||
|
System.out.println("_filesize \t = " + _filesize);
|
||||||
|
System.out.println("_start_offset \t = " + _start_offset);
|
||||||
|
System.out.println("_end_offset \t = " + _end_offset);
|
||||||
|
System.out.println("_filepath \t = " + _filepath);
|
||||||
|
System.out.println("_el \t = " + _el);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CORS 관련 헤더 추가
|
||||||
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
|
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||||
|
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||||
|
%>
|
||||||
76
src/main/webapp/innorix/gnexam/uploadExtension.html
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upload.jsp', // 업로드 URL
|
||||||
|
|
||||||
|
allowExtension: { // 정의된 확장자 파일만 추가
|
||||||
|
"Image files (*.jpg, *.png)" : ["jpg", "png"],
|
||||||
|
"Pdf files (*.pdf)" : ["pdf"]
|
||||||
|
}, // 그룹화방신 { "그룹명" : [허용확장자] }
|
||||||
|
limitExtension: ["zip","pdf"] // 정의된 확장자 파일을 제외
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
allowExtension
|
||||||
|
- 정의된 확장자 파일만 추가
|
||||||
|
- limitExtension과 동일 확장자 정책 지정 시, limitExtension을 우선 적용
|
||||||
|
|
||||||
|
limitExtension
|
||||||
|
- 정의된 확장자 파일을 제외
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 파일 첨부시 에러
|
||||||
|
control.on('addFileError', function (p) {
|
||||||
|
console.log(p[0].type);
|
||||||
|
console.log(p[0].message);
|
||||||
|
//382버전 이상 출력방법으로, 이하 버전 사용자는 예제 [파일첨부 에러 시 메세지 출력(373이하 버전)] 참고
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
console.log(files);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
// innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
43
src/main/webapp/innorix/gnexam/uploadIframe.html
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
innorix.setLanguage('ko'); // 한/영설정 [en,ko]
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'upload', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
showGraph: 'true', // 우측 그래프 출력
|
||||||
|
uploadUrl: './upload.jsp', // 업로드 URL
|
||||||
|
agent: false, // Agent 사용여부
|
||||||
|
iframeView: true, // iframe 내 출력 여부
|
||||||
|
iframeViewLocation: 'parent', // iframe 영역 내 출력시 전송창 출력 위치 top(최상단) | parent(바로위)
|
||||||
|
iframeViewCssUrl: '<link rel="stylesheet" href="../innorix.css">' // 영역 외 출력 시 참조 css 경로
|
||||||
|
// iframeViewTop: '20px', //xx px 출력 영역 내 상단 기준 출력 위치
|
||||||
|
// iframeViewLeft: '20px', //xx px 출력 영역 내 장축 기준 출력 위치
|
||||||
|
// iframeViewMarginTop: '200px', //xx px 출력 영역 내 상단 기준 마진
|
||||||
|
// iframeViewMarginLeft: '20px', //xx px 출력 영역 내 장축 기준 마진
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
console.log(p);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
66
src/main/webapp/innorix/gnexam/uploadRetryCount.html
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link rel="stylesheet" href="../innorix.css">
|
||||||
|
<script src="../innorix.js"></script>
|
||||||
|
<script>
|
||||||
|
var control = new Object();
|
||||||
|
innorix.setLanguage('ko');
|
||||||
|
window.onload = function() {
|
||||||
|
// 파일전송 컨트롤 생성
|
||||||
|
control = innorix.create({
|
||||||
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||||
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||||
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||||
|
uploadUrl: './upld.jsp', // 존재하지 않는 업로드 URL로 설정
|
||||||
|
|
||||||
|
retryCount: 2, // 재전송 횟수
|
||||||
|
retryDelay: 2, // 재전송 간격(sec)
|
||||||
|
maximumErrorCount: 2 // 최대 에러 허용 횟수
|
||||||
|
});
|
||||||
|
|
||||||
|
//업로드 에러
|
||||||
|
control.on('uploadError', function (p) {
|
||||||
|
|
||||||
|
console.log(p);
|
||||||
|
var f = p.files;
|
||||||
|
var m = p.statusMessage;
|
||||||
|
console.log("customError : "+m.customError);
|
||||||
|
console.log("errorCode : "+m.errorCode);
|
||||||
|
console.log("id : "+m.id);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업로드 완료 이벤트
|
||||||
|
control.on('uploadComplete', function (p) {
|
||||||
|
console.log(p.files);
|
||||||
|
var f = p.files;
|
||||||
|
var r = "Upload complete\n\n";
|
||||||
|
for (var i = 0; i < f.length; i++ ) {
|
||||||
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||||
|
}
|
||||||
|
alert(r);
|
||||||
|
|
||||||
|
var files = JSON.stringify(f);
|
||||||
|
var innoJquery = innorix._load("innoJquery");
|
||||||
|
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||||
|
//innoJquery('form#f_write').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||||
|
|
||||||
|
<form action="./result.jsp" id="f_write" name="f_write" method="post">
|
||||||
|
test1 : <input type="text" name="test1" />
|
||||||
|
</form><br />
|
||||||
|
|
||||||
|
<div id="fileControl"></div><br/>
|
||||||
|
|
||||||
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||||
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||||
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||